/** * <p> * Checks to see if the given object is equal to this lexical category. * This is done by checking the enumeration if the object is of the type * <code>LexicalCategory</code> or by converting the object and this * category to strings and comparing the strings. * </p> * <p> * For example, <code>LexicalCategory.NOUN</code> will match another * <code>LexicalCategory.NOUN</code> but will also match the string * <em>"noun"</em> as well. */ public override bool Equals(object checkObject) { bool match = false; if (!ReferenceEquals(checkObject, null)) { if (checkObject is LexicalCategory) { match = _lexicalCategory.Equals(((LexicalCategory)checkObject).GetLexicalCategory()); } else if (checkObject is LexicalCategoryEnum) { match = _lexicalCategory == (LexicalCategoryEnum)checkObject; } else { match = ToString().Equals(checkObject.ToString(), StringComparison.OrdinalIgnoreCase); } } return(match); }