Meeting the needs of your business from a distance

.NET Attribute Keywords

by mark shiffer 9. February 2011 15:43

I ran across this list of attributes for .NET that while it is not comprehensive, it did appear useful to keep around for future reference. The list was provided originally on the DevCurry blog in a post entitled Attributes Every .NET Developer Should Know About.

.NET Attribute

Description

AttributeUsage When you are defining your own attribute class, you can control the manner in which it is used by placing an AttributeUsageAttribute on your attribute class
CLS Compliant Indicates whether a program element is compliant with the Common Language Specification (CLS)
Conditional Indicates to compilers that a method call or attribute should be ignored unless a specified conditional compilation symbol is defined
Debuggable Modifies code generation for runtime just-in-time (JIT) debugging
DebuggerDisplay Determines how a class or field is displayed in the debugger variable windows
DebuggerStepThrough Debugger does not stop in a method marked with this attribute but does allow a breakpoint to be set in the method
DefaultValue Specifies the default value for a property
DesignerSerializationVisibility Specifies the type of persistence to use when serializing a property on a component at design time
Description Specifies a description for a property or even
DisplayName Specifies the display name for a property, event, or public void method which takes no arguments
DllImport Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point
EditorBrowsable Specifies that a property or method is viewable in an editor
Flags Indicates that an enumeration can be treated as a bit field; that is, a set of flags
InternalsVisibleTo Specifies that types that are ordinarily visible only within the current assembly are visible to a specified assembly
MTAThread Indicates that the COM threading model for an application is multithreaded apartment (MTA)
NonSerialized Indicates that a field of a serializable class should not be serialized
Obsolete Marks the program elements that are no longer in use
ParamArray Indicates that a method will allow a variable number of arguments in its invocation
Serializable Indicates that a class can be serialized
WebMethod Adding this attribute to a method within an XML Web service created using ASP.NET makes the method callable from remote Web clients
WebService Used to add additional information to an XML Web service, such as a string describing its functionalit
XMLIgnore Instructs the Serialize method of the XmlSerializer not to serialize the public field or public read/write property value
XMLElement Indicates that a public field or property represents an XML element when the XmlSerializer serializes or deserializes the object that contains it
XMLRoot Controls XML serialization of the attribute target as an XML root element
XMLText Indicates to the XmlSerializer that the member must be treated as XML text when the class that contains it is serialized or deserialized
ThreadStatic Indicates that the value of a static field is unique for each thread

Tags:

Comments

Add comment


(Will show your Gravatar icon)

  Country flag


  • Comment
  • Preview
Loading



Copyright © 2001-2012 MS Consulting, Inc. All Rights Reserved.