public static MyColor GetColor(this MyFruit fruit) { var type = fruit.GetType(); var memInfo = type.GetMember(fruit.ToString()); var attributes = memInfo[0].GetCustomAttributes(typeof(MyFunkyAttribute), false); if (attributes.Length > 0) { return(((MyFunkyAttribute)attributes[0]).Color); } throw new InvalidOperationException("blah"); }
public void SimpleEnum(MyFruit fruit) { Context.Logger.LogInformation(fruit.ToString()); }