/// <summary> /// Determines whether the current US state instance is equal to the specified one. /// </summary> /// <param name="state">The US state instance to be compared with the current one.</param> /// <returns>True, if the current US state instance is equal to the specified one; otherwise, false.</returns> public bool IsEqualTo(USState state) { return Code.IsEquivalentTo(state.Code); }
public static bool TryParse(string stateCodeName, out USState? state) { state = null; if(stateCodeName.IsBlank()) return false; var pattern = stateCodeName.Trim(); var foundState = All().SingleOrDefault(s => s.Code.IsEquivalentTo(pattern) || s.Name.IsEquivalentTo(pattern)); if(foundState.Code.IsNotBlank()) { state = foundState; return true; } return false; }