Possible Duplicate:
Most Useful Attributes in C#
besides:
[DefaultValue(100)]
[Description("Some descriptive field here")]
public int MyProperty{get; set;}
What other C# Attributes are useful for Properties, after learning these I feel like I'm Missing out.
Related Questions
Most Useful Attributes in C#
attr1 appertains to the variable declarations a and b, attr2 appertains to the type int, attr3 appertains to the variable declaration a, and attr4 appertains to the variable declaration b.
The __attribute__ directive is used to decorate a code declaration in C, C++ and Objective-C programming languages. This gives the declared code additional attributes that would help the compiler incorporate optimizations or elicit useful warnings to the consumer of that code.
Attributes and methods are basically variables and functions that belongs to the class. These are often referred to as "class members". A class is a user-defined data type that we can use in our program, and it works as an object constructor, or a "blueprint" for creating objects.
Like other objects, a function is defined by a set of attributes. It shares many of the attributes of variables, including identifier, title, units, description, and definition, inputs, and outputs.
[Obsolete("This is an obsolete property")]
That's one of my favourites. Allows you to mark a property/method obsolete, which will cause a compiler warning (optionally, a compiler error) on build.
Just a few...
synchronization, inlining, etc:
[MethodImpl]
component model:
[TypeDescriptor], [DisplayName], [Editor]
serialization:
[Serializable], [DataMember], [XmlElement], [XmlAttribute], [NonSerialized], etc
declarative security:
[PrincipalPermission]
all the COM stuff...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With