csharp中的属性学习 [英] attributes learning in csharp

查看:151
本文介绍了csharp中的属性学习的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的朋友们

属性是c#和其他dotnet语言中重要且有用的东西
我该如何了解呢??????
msdn中是否有关于属性以及如何使用它们的完整参考??????
c#中有没有使用属性的好示例???????
我想学习所有有关属性的知识,任何人都可以在c#.net中向我介绍一个很好的参考或示例?????????????

hi My friends

the attributes are the important and useful things in c# and other dotnet languages
how can i learn about that??????
is there any full references in msdn about attributes and how to use them???????
is there any good example in c# that uses attributes????????
i want to learn all about attributes,any one can introduce a good reference or example in c#.net to me??????????????

推荐答案

属性定义与类,结构,方法等关联的其他信息(元数据). 例如,您可以定义一个属性,该属性确定类将显示的按钮的类型.

属性是在方括号之间指定的,在它们所应用的项目之前.因此,属性不是类的成员.而是,属性指定附加到项目的补充信息.

请参阅此以获取更多详细信息:

http://msdn.microsoft.com/en-us/library/aa287992%28v = vs.71%29.aspx [ ^ ]

希望这会有所帮助:)
An attribute defines additional information (metadata) that is associated with a class, structure, method, and so on. For example you might define an attribute that determines the type of button that a class will display.

Attributes are specified between square brackets, preceding the item to which they apply. Thus, an attribute is not a member of a class. Rather, an attribute specifies supplemental information that is attached to an item.

refer this for more details:

http://msdn.microsoft.com/en-us/library/aa287992%28v=vs.71%29.aspx[^]

hope this helps :)


问候;

除了来自Uday和2irfanshaikh的建议外,您可能还希望阅读Tom Barnaby和Jason Bock撰写的APress书 Applied .NET属性(APress,2003 ISBN13:978-1-59059-136- 9).尽管过时了一些,但随着它的发布与.NET 1.1 Framework和CLR的主要发布相吻合,本文提供的大部分内容仍然适用于.NET 3.0、3.5和4.0.作者涵盖以下主题:属性基础知识,编译时和设计时属性,属性和运行时行为,构建自定义属性和应用自定义属性.可以在亚马逊上获得章节预览:
Greetings;

In addition to the reccommendations from Uday and 2irfanshaikh, you may want to look into the APress book Applied .NET Attributes from Tom Barnaby and Jason Bock (APress, 2003 ISBN13: 978-1-59059-136-9). Although a bit dated, as its publication coincided with the major release of the .NET 1.1 Framework and CLR, much of what is presented is still applicable with .NET 3.0, 3.5 and 4.0. The authors provide coverage on the following topics: Attribute Fundamentals, Compile-time and Design-time Attributes, Attributes and Runtime Behavior, Building Custom Attributes and Applying Custom Attributes. A chapter preview is available at amazon: http://www.amazon.com/Applied-NET-Attributes-Tom-Barnaby/dp/1590591364/ref=sr_1_1?ie=UTF8&s=books&qid=1309971685&sr=1-1

I hope this was of help...


请尝试以下链接:

在.NET应用程序中创建和使用属性 [ C#中的属性 [
Please try the below links:

Creating and Using Attributes in your .NET application[^]

Attributes in C#[^]


这篇关于csharp中的属性学习的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆