/// <summary> /// Returns true if the word is spelled correctly. /// </summary> /// <param name="namingService"> /// The naming service to use. /// </param> /// <param name="word"> /// The word to check. /// </param> /// <param name="hint"> /// A message indicating why the word isn't spelled correctly, or <see langword="null"/> if there is none. /// </param> /// <returns> /// True if spelled correctly; otherwise, False. /// </returns> private static bool IsSpelledCorrectly(NamingService namingService, string word, out string hint) { string alternate; alternate = namingService.GetPreferredAlternateForDeprecatedWord(word); if (alternate != null) { // Deprecated word, preferred alternate should be used. hint = (alternate.Length > 0) ? string.Format(CultureInfo.InvariantCulture, Strings.SpellingPreferredAlternate, alternate) : null; return(false); } alternate = namingService.GetCompoundAlternateForDiscreteWord(word); if (alternate != null) { // Compound alternate should be used. hint = (alternate.Length > 0) ? string.Format(CultureInfo.InvariantCulture, Strings.SpellingUseCompoundWord, alternate) : null; return(false); } if (namingService.CheckSpelling(word) == WordSpelling.Unrecognized) { // Spelling error. hint = null; return(false); } // No error. hint = null; return(true); }
/// <summary> /// Returns true if the word is spelled correctly. /// </summary> /// <param name="namingService"> /// The naming service to use. /// </param> /// <param name="word"> /// The word to check. /// </param> /// <returns> /// True if spelled correct. /// </returns> private static bool IsSpelledCorrectly(NamingService namingService, string word) { return((namingService.GetPreferredAlternateForDeprecatedWord(word) == null) && (namingService.GetCompoundAlternateForDiscreteWord(word) == null) && (namingService.CheckSpelling(word) != WordSpelling.Unrecognized)); }