public bool Equals(KeyValueTriplet <TKey, TNumericKey, TValue> value) { bool flag; flag = (!object.ReferenceEquals(value, null) ? this.Key.Equals(value.Key) : false); return(flag); }
public static List <KeyValueTriplet <TKey, TNumericKey, string> > ToExtendedList <TKey, TNumericKey>(this Type type, bool incluirOcultos) where TKey : struct { if (type == null) { throw new ArgumentNullException("type"); } if (!type.IsEnum) { throw new InvalidCastException("El tipo no es un enumerador"); } if (typeof(TKey) != type) { throw new InvalidCastException("Debe coincidir el Typo con el generic de TKey"); } List <KeyValueTriplet <TKey, TNumericKey, string> > keyValueTriplets = new List <KeyValueTriplet <TKey, TNumericKey, string> >(); foreach (Enum value in Extension.GetValues(type)) { EnumDescriptionAttribute enumDescriptionAttribute = value.GetEnumDescriptionAttribute(); string str = value.ToString(); bool flag = true; KeyValueTriplet <TKey, TNumericKey, string> keyValueTriplet = new KeyValueTriplet <TKey, TNumericKey, string>() { Key = (TKey)Enum.Parse(type, str, true), NumericKey = (TNumericKey)Convert.ChangeType(value, typeof(TNumericKey), CultureInfo.InvariantCulture), Value = str }; KeyValueTriplet <TKey, TNumericKey, string> keyValueTriplet1 = keyValueTriplet; if (enumDescriptionAttribute != null) { flag = (!enumDescriptionAttribute.Ocultar ? true : incluirOcultos); string str1 = Extension.BuscarDescripcion(enumDescriptionAttribute); if (!string.IsNullOrEmpty(str1)) { keyValueTriplet1.Value = str1; } } if (flag) { keyValueTriplets.Add(keyValueTriplet1); } } return(keyValueTriplets); }