开发者

Attributes in .net [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

When should I use attribute in C#?

Hi, I am trying to understand how Attributes in .net works.

As we all know Attributes are of two types metadata and context attributes.

Metadata attributes: it allows some data to be attached to a class or method. This data becomes part of the metadata for the开发者_开发百科 class, and can be accessed via reflection.

Firstly, why do we need custom attributes please give examples and How is that information attached with that class and how will it be interpreted.

Custom attributes: Please explain this and explain the flow how is that custom class which is derived System.Attribute is executed and how will that information be useful to the current class or method which uses that attribute. (best example is Validation Block is applied as attributes to the property or methods and it will be automatically validated. how is this possible).

I have the basic understanding of attributes and how it works and looking at the process how that works.

Thanks in advance.


I think these tutorials might help you:

http://oreilly.com/catalog/progcsharp/chapter/ch18.html

http://msdn.microsoft.com/en-us/library/aa288454(v=vs.71).aspx

http://www.dotnetjohn.com/articles.aspx?articleid=273

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜