我编写了我的通用方法(使用网络上的偷窥)来获取类名的属性。这是密码。public T GetAttributeOfObject<T>(Type objectTypeToCheck) object myAttribute = (T)Attribute.GetCustomAttributeCannot convert type System.Attribute to T:
object</em
我有一堂课:public class SomeClass}internal class DefiniteAttribute: Attribute}var definiteAttribute = (DefiniteAttribute) typeof(SomeClass).GetCustomAttribu