草庐IT

FastPropertyGetHandler

全部标签

c# - 任何人都知道一种快速获取枚举值自定义属性的方法吗?

这可能最好用一个例子来说明。我有一个带有属性的枚举:publicenumMyEnum{[CustomInfo("Thisisacustomattrib")]None=0,[CustomInfo("Thisisanotherattrib")]ValueA,[CustomInfo("Thishasanextraflag",AllowSomething=true)]ValueB,}我想从实例中获取这些属性:publicCustomInfoAttributeGetInfo(MyEnumenumInput){TypetypeOfEnum=enumInput.GetType();//thiswil