public override bool Equals(object obj) { // One of them is null. Oid lOid = obj as Oid; if (lOid == null || !lOid.IsValid()) { return(false); } if (string.Compare(ClassName, lOid.ClassName, true) == 0) { // Check Count. if (Fields.Count == lOid.Fields.Count) { // Check Values. for (int i = 0; i < Fields.Count; i++) { IOidField lOidField = Fields[i]; if (lOidField.Value == null) { return(false); } if ((lOidField.Type == ModelType.String) || (lOidField.Type == ModelType.Text)) { // String comparation (No Case Sensitive). if (!string.Equals(lOidField.Value.ToString(), lOid.Fields[i].Value.ToString(), StringComparison.OrdinalIgnoreCase)) { return(false); } } else { // Object comparation. if (!lOidField.Value.Equals(lOid.Fields[i].Value)) { return(false); } } } return(true); } } return(false); }
/// <summary> /// Checks whether an Oid object is not null and is a valid Oid. /// </summary> /// <param name="oid">Oid object.</param> /// <returns>Returns true if the Oid is not null and valid. Otherwise, returns false.</returns> public static bool IsNotNullAndValid(Oid oid) { return((oid != null) && oid.IsValid()); }