¡@

Home 

c# Programming Glossary: attribute.isdefined

Attribute.IsDefined doesn't see attributes applied with MetadataType class

http://stackoverflow.com/questions/1910532/attribute-isdefined-doesnt-see-attributes-applied-with-metadatatype-class

doesn't see attributes applied with MetadataType class If I.. MetadataType attribute those attributes are not found via Attribute.IsDefined . Anyone know why or what I'm doing wrong Below is a test project.. propertyInfo in properties Console.WriteLine Attribute.IsDefined propertyInfo typeof MyAttribute Console.WriteLine propertyInfo.IsDefined..

Check if property has attribute

http://stackoverflow.com/questions/2051065/check-if-property-has-attribute

typeof YourClass var pi t.GetProperty Id var hasIsIdentity Attribute.IsDefined pi typeof IsIdentity If you need to retrieve attribute properties..

How do I get the member to which my custom attribute was applied?

http://stackoverflow.com/questions/2168942/how-do-i-get-the-member-to-which-my-custom-attribute-was-applied

BindingFlags.Instance BindingFlags.Public if Attribute.IsDefined prop typeof RequiredAttribute object value prop.GetValue o..

How to get a list of properties with a given attribute?

http://stackoverflow.com/questions/2281972/how-to-get-a-list-of-properties-with-a-given-attribute

this question var props t.GetProperties .Where prop Attribute.IsDefined prop typeof MyAttribute This avoids having to materialize any..

How To Test if a Type is Anonymous? [duplicate]

http://stackoverflow.com/questions/2483023/how-to-test-if-a-type-is-anonymous

The only way to detect anonymous types right now. return Attribute.IsDefined type typeof CompilerGeneratedAttribute false type.IsGenericType..

Why is Attributes.IsDefined() missing overloads?

http://stackoverflow.com/questions/3026405/why-is-attributes-isdefined-missing-overloads

Except for one biggy there is no overload for Attribute.IsDefined Type Type so that you could check if an attribute is defined.. share improve this question There's a System.Attribute.IsDefined MemberInfo element Type attributeType bool inherit and System.Type..

get all types in assembly with custom attribute

http://stackoverflow.com/questions/4852879/get-all-types-in-assembly-with-custom-attribute

... var types from type in assembly.GetTypes where Attribute.IsDefined type typeof FindableAttribute select type EDIT Moved from MemberInfo.GetCustomAttributes.. type EDIT Moved from MemberInfo.GetCustomAttributes to Attribute.IsDefined based on Marc Gravell's suggestion. share improve this answer..

How to check if an object is serializable in C#

http://stackoverflow.com/questions/81674/how-to-check-if-an-object-is-serializable-in-c-sharp

bool IsSerializable T obj return obj is ISerializable Attribute.IsDefined typeof T typeof SerializableAttribute Or even better just get..

MVC Custom Authentication, Authorization, and Roles Implementation

http://stackoverflow.com/questions/8567358/mvc-custom-authentication-authorization-and-roles-implementation

Type ' 0 ' is not an enum typeof T .FullName if Attribute.IsDefined typeof T typeof FlagsAttribute throw new ArgumentException..