What are Attributes in C#
I am learning Csharp to work on .Net platform. This is the first time I am trying my hands on software programming. Although I have to admit that Csharp is really a good programming language, but I am finding it quite difficult to grasp. I am confused about Attributes in Csharp. I am not able to learn this topic. Can anyone explain it to me. Please help.
Re: What are Attributes in C#
In Csharp you can releate a code and declarative data using Attribures. This code can be methods, type, properties, etc. The Attribute acted upon at runtime. The Reflection procedure is used to querry the Attribute. Attributes are basically sagrigated into two: One which are said to be the custom attributes. These custom attributes are helpful in applying some more inforamation for your Csharp program code. The other types of Attributes are those which are defined in the Base Class library of Common Language Runtime.
Re: What are Attributes in C#
In simple language, it is way using which we can associate the Declarative information with defined C sharp types. C sharp Attributes are capable of assigning your program with meta-data.We are allowed to create Custom Attributes also. For creating custom attributes we need to define an Attribute class. This class derives from the System.Atrributes. Attributes can useful for defining Documentation information which is a Design-Time information, or even Run-Time information. It can even be useful in defining whether a member is allowed or not to be a part of the transcation. Attributes are commonly used when interacting with COM i.e Component Object Model.
Re: What are Attributes in C#
Attributes are a new kind of declarative information in C#. To mark any element of code which includes class or method, we can use Attributes. C Sharp Attributes have the capability to be placed on any declaration. Attributes can be used in defining design level inforamation as well as run time information.