I wanted to write something that would find all pyramid words within a supplied text file or list of strings. An example of a pyramid word is the word deadheaded. It has one of the letter h, two of a, three of e, and four of d.    This would form a pyramid if you were to stack the letters:   h  a a e e ed d d dI'm looking for input regarding various things, such as design (is this constructed well for a user and easy to understand?), extensibility, using the right data structures, dealing with input/output...Would this be better designed with more OOP in it? For example, I could have a base class with sub classes finding words with different shapes than a pyramid. But I'm not sure how much it would help in this design, as it seems fairly script-like with all the string manipulation.public class PyramidWordsFinder{    public PyramidWordsFinder()    {        this.pyramidWordList = new List<string>();    }    public IList<string> pyramidWordList { get; set; }    public IReadOnlyList<string> LoadDictionaryFile(string filePath)    {        List<string> wordsDictionary = new List<string>();        Encoding enc = Encoding.GetEncoding(1250);        string[] lines = File.ReadAllLines(filePath, enc);        wordsDictionary.AddRange(lines.Where(x => x.Length > 2));        return wordsDictionary.AsReadOnly();    }    public void WriteWordListToFile(IEnumerable<string> words, string fullFileName)    {        if (String.IsNullOrWhiteSpace(fullFileName))        {            throw new ArgumentException(The file name is not correctly formed);        }        File.WriteAllLines(fullFileName, words);    }    public IList<string> FindPyramidWords(IReadOnlyList<string> wordList)    {        foreach (var word in wordList)        {            // Quick checks before seeing if pyramid word            if (this.WordIsCorrectLength(word) && (word.ToLower().Distinct().Count() == this.GetMaximumLetterFrequency(word)))                {                if (this.DetermineIfWordIsPyramid(word))                {                    this.pyramidWordList.Add(word);                }            }        }        return this.pyramidWordList;    }    private int GetMaximumLetterFrequency(string word)    {        int total = 0;        for (int i = 1; i <= word.Length; i++)        {            total += i;            if (total == word.Length) return i;                      }        return 0;    }    private bool WordIsCorrectLength(string word)    {        var correctLengths = new List<int> {6, 10, 15, 21, 28, 36, 45, 55 };        if (correctLengths.Any(item=> item == word.Length))        {            return true;        }        return false;    }    /// <summary>    /// Determines if the given word is a pyramid word     /// </summary>    /// <param name=word></param>    /// <returns></returns>    public bool DetermineIfWordIsPyramid(string word)    {        var lowerCaseWord = word.ToLower();        List<int> letterCounts = new List<int>();        var distinctLetters = lowerCaseWord.ToLower().Distinct();        // Adds up how many times each distinct letter is seen in the word        foreach (var letter in distinctLetters)        {            var numLetters = lowerCaseWord.Count(x => x == letter);            letterCounts.Add(numLetters);        }        // determines if the frequency the distinct letters descends consecutively        var maximumLetterFrequency = this.GetMaximumLetterFrequency(lowerCaseWord);        for (var i = maximumLetterFrequency; i >= 1; i--)        {            if (!letterCounts.Contains(i)) return false;        }        return true;    }}
Find all words that can create a pyramid
c#;.net;error handling