private static void LoadFields(Type t) { if (!staticFields.ContainsKey(t)) { lock (staticFieldsLock) { if (!staticFields.ContainsKey(t)) { Dictionary <string, ConstantClass> dictionary = new Dictionary <string, ConstantClass>(StringComparer.OrdinalIgnoreCase); foreach (FieldInfo field in TypeFactory.GetTypeInfo(t).GetFields()) { if (field.IsStatic && field.FieldType == t) { ConstantClass constantClass = field.GetValue(null) as ConstantClass; dictionary[constantClass.Value] = constantClass; } } staticFields = new Dictionary <Type, Dictionary <string, ConstantClass> >(staticFields) { [t] = dictionary }; } } } }
public bool Equals(ConstantClass obj) { if ((object)obj == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(Value, obj.Value)); }
public virtual bool Equals(ConstantClass obj) { if ((object)obj == null) { // If obj is null, return false. return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(this.Value, obj.Value)); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (this == obj) { return(true); } ConstantClass obj2 = obj as ConstantClass; if (Equals(obj2)) { return(true); } string text = obj as string; if (text != null) { return(StringComparer.OrdinalIgnoreCase.Equals(Value, text)); } return(false); }