/// <summary> /// Equal operator overload /// </summary> /// <param name="obj">the object to compare to</param> /// <returns>bool</returns> public override bool Equals(Object obj) { // // Two EnumConstant instances are considered equal of they are of the // same concrete subclass and have the same type/value strings. If // a subtype adds additional member elements that effect the equivalence // test, it *must* override this implemention. // if (obj == null || !this.GetType().Equals(obj.GetType())) { return(false); } EnumConstruct ec = (EnumConstruct)obj; if (Type.Equals(ec.Type) == false) { return(false); } if (Value != null) { return(Value.Equals(ec.Value)); } return(ec.Value == null); }
/// <summary> /// Get the Value of possibly null EnumConstruct /// </summary> /// <param name="enumConstruct">The Google EnumConstruct</param> /// <returns>The value or empty string if the enumConstruct or it's Value was null</returns> public static string SafeGetValue(EnumConstruct enumConstruct) { if (enumConstruct == null) { return string.Empty; } return enumConstruct.Value ?? string.Empty; }