attribute是什么意思

文章插图
v.把…归因于;认为…是由于;认为是…所为(或说、写、作)n.属性;性质;特征第三人称单数: attributes 复数: attributes 现在分词: attributing 过去式: attributed 过去分词: attributed派生词: attribution n.Women tend to attribute their success to external causes such as luck. 女性倾向于将她们的成功归因于外部因素,比如运气 。扩展资料;qualityn. 特性,特征普通用词,指有形或无形的特性,也可指个性或共性的特征 。She has a childlike quality.她有着孩子般的天真特质 。
什么是Attributen.属性; 象征v.把…归因于; 认为…属于; 认为某人(某物)具有某种特性网络定语; 特征; 品质变形过去式:attributed; 现在分词:attributing; 第三人称单数:attributes搭配attribute blame例句The name of the element to be created is specified by a required name attribute and an optional namespace attribute.要创建的元素的名称由必选的name属性和可选的namespace属性指定 。
什么是Attributeattribute
作动词时vt.认为…是; 把…归于; 把…品质归于某人; 认为某事[物]属于某人[物];
attribute
作名词时n.属性; (人或物的)特征; 价值; [语法学]定语;
什么是AttributeAttribute属性意思,在编程语言中往往是指向说明标签、变量、对象等元素的属性的意思,使用setAttribute和getAttribute来设置元素的属性
什么是Attributeattribute
英 ['ætrɪbjuːt]美 ['ætrɪbjuːt]
vt.把 ... 归于
n.属性;标志;象征;特征
【语法】修饰语,定语 , 属性形容词 , 限定词(在名词短语中修饰名词的形容词)
【逻辑学】属性,性质
名誉,荣誉
查看更多v.(动词)
把…归因于...,把…归咎于 , 认为…是由于
认为…是某人所做,认为是…所为
point的意思是什么意思point的意思是得分,表明,句中作为名词和动词使用,既可以是及物动词也可以是不及物价动词 。一、词汇分析point英 [pɒɪnt]美 [pɔɪnt] n. 要点;得分;标点;[机] 尖端vt. 指向;弄尖;加标点于vi. 表明;指向二、短语1、Match Point 导演伍迪 ; 迷失决胜分 ; 赛末点 ; 爱情决胜点2、critical point [物] 临界点 ; 紧要关头 ; [流] 驻点 ; 关键点3、West Point [天] 西点 ; 西点军校 ; 美国西点军校 ; 西洋糕点军校4、Focal point 谢林点 ; [光] [数] 焦点 ; 聚焦点 ; 汇点三、例句1、We disagree with every point she makes.我们不同意她提出的任何观点 。2、The following account will clearly illustrate this point.以下的陈述将清楚地阐明这一看法 。扩展资料point的近义词有core , main , heart , kernel , essential 。一、core英 [kɔː]美 [kɔr] n. 核心;要点;果心;[计] 磁心vt. 挖...的核1、We already have our core team in place.我们的核心队伍已经就位 。2、The core subjects are English, mathematics and science.必修课程为英语、数学和科学 。二、heart英 [hɑːt]美 [hɑrt] n. 心脏;感情;勇气;心形;要点vt. 鼓励;铭记vi. 结心1、Alik's words filled her heart with pride.亚历克的话让她的内心充满骄傲 。2、The bullet had passed less than an inch from Andrea's heart.子弹从距安德烈亚心脏不到一英寸处穿过 。
attribute是什么意思attribute
英 [əˈtrɪbju:t]美 [əˈtrɪbjut]
vt.
认为…是;把…归于;把…品质归于某人;认为某事[物]属于某人[物]
n.
属性;(人或物的)特征;价值;[语法学]定语
第三人称单数: attributes 复数: attributes
现在分词: attributing 过去式: attributed 过去分词: attributed
DC里面每个attribute是什么意思??元素用于向元素添加属性
nominal attribute是什么意思nominal attribute
名词属性
请采纳
如果你认可我的回答,敬请及时采纳,
~如果你认可我的回答,请及时点击【采纳为满意回答】按钮
~~手机提问的朋友在客户端右上角评价点【满意】即可 。
~你的采纳是我前进的动力
~~O(∩_∩)O,记得好评和采纳 , 互相帮助
attribute是什么意思attribute英 [ə'trɪbjuːt]美 [ə'trɪbjut]
n. 属性;特质
vt. 归属;把…归于
ascribe/attribute/owe to有什么区别

文章插图
一、含义不同1、attribute :出于相信而把……归于某人或某物 。2、ascribe :指根据推论或猜想把……归于某人或某物 。3、owe to 把……归功于 。二、用法不同1、attribute …… to……“把……归因于”、“把……归咎于”,指客观地将某事归于某人或某物,常用结构是:attribute…… to ……(主动语态,主语多为人); be attributed to ……(被动语态主语多为某事)The teacher attributes the student’s poor comprehension to the lack of intelligence. 老师把这位学生理解能力差归因于缺乏智力 。2、ascribe多采用ascribe …… to ……结构,表示“把……归因于”、“把……归咎于” 。It is wrong to ascribe all that have happened to the manager’s fault. 把所发生的一切都归咎于经理的过失是是错误的 。3、owe …… to……“把……归功于”、“把……归因于”,只用主动形式,不用被动形式,句子主语通常是“人”,指某人将某事归因(功)于某人或某物 。If I have improved in any way, I owe it all to you. 如果我在某一方面有所进步,那应归功于你 。三、表示的主客观性及感情色彩不同1、attribute :出于相信而把……归于某人或某物,含较多的客观性 。It is generally agreed that fluctuations in birth rate are attributed to a number of economic factors.人们普遍认为出生率的波动归结于诸多经济因素 。2、ascribe : 指凭猜想推断,强调主观臆断 , 所作的推断不如attribute确定 。This play is usually ascribed to Shakespeare.通常认为这部剧是莎士比亚所写 。3、owe to 把...归功于,多用于褒义 。He owes his great success in his research work to the guidance of his tutor. 他把他在研究工作的巨大成功归功于他的导师的指导 。
attribute to 和owe to 当归因于讲的时候用法有什么不同吗owe... to...与attribute... to...有一个很重要的区别就是:
owe... to...的主语既可以是人,也可以是物;
而attribute... to...的主语则只能是人 。另外,owe... to...只用于主动句,大都与褒义词连用 。
例如:
He owes his success to his father. 他把他的成功归功于他的父亲 。
Jim attributes his success to hard work. 吉姆把他的成功归功于努力工作 。
Economists attributed the slow progress in economy to poor
cooperation. 经济学家把经济增长缓慢归咎于合作不好 。
owe..to和attribute..to区别owe...
to...与attribute...
to...有一个很重要的区别就是:
owe...
to...的主语既可以是人 , 也可以是物;
而attribute...
to...的主语则只能是人 。另外,
owe...
to...只用于主动句,大都与褒义词连用 。
例如:
He
owes
his
success
to
his
father.
他把他的成功归功于他的父亲 。
Jim
attributes
his
success
to
hard
work.
吉姆把他的成功归功于努力工作 。
Economists
attributed
the
slow
progress
in
economy
to
poor
cooperation.
经济学家把经济增长缓慢归咎于合作不好 。
attribute to 和owe to 当归因于讲的时候用法有什么不同吗attribute to 作归因于讲的时候有以下三点用法:
1. 把...归因于;把...归咎于[(+to)]
He attributed his good health to exercise.
他认为自己之所以身体好是因为运动 。
你觉得把软弱当作女性的属性适当吗?
2. 认为...是某人所做[H][(+to)]
That play was wrongly attributed to Bacon.
那个剧本被错误地认为是培根的作品 。
owe to 归因于讲的时候:
1 (应)感激[(+to)] , 与attribute to相比,强调“感恩”;
We owe a great deal to our parents.
我们深受父母之恩 。
2 应该把...归功于[(+to)],与attribute to无异;
We owe to Newton the principle of gravitation.
我们全靠牛顿才知道引力的原理 。
owe..to和attribute..to区别owe to 和attribute to 严重的不一样 , 这个必须查英文原版字典 , 另外还要好好的体会,A owe B to C 这个里面强调了 A与B中有所属关系即A拥有B 。而attribute没有这层关系,这个例子如果我去选只会优选选择owe , 另外attribute 在这个地方不能用 。因为attribute核心的意思个给予,它包含使动 , 一个概念是不可能把数学系统作为他们成功的原因 。
attribute是什么意思attribute属性;特性;定语;归因于People were beginning to attribute superhuman qualities to him. 人们开始觉得他超人一等 。很高兴第一时间为您解答,祝学习进步如有问题请及时追问,谢谢~~O(∩_∩)O
什么是Attributeattribute英[əˈtrɪbju:t]美[əˈtrɪbjut]
vt.认为…是; 把…归于; 把…品质归于某人; 认为某事[物]属于某人[物];
n.属性; (人或物的) 特征; 价值; [语法学] 定语;
[例句]Women tend to attribute their success to external causes such as luck.
女性倾向于将她们的成功归因于外部因素,比如运气 。
[其他]第三人称单数:attributes 复数:attributes 现在分词:attributing过去式:attributed 过去分词:attributed
英语词汇attribute 的用法 。attributed to the chinese.是修饰前面的renderings的,如果看不懂 , 可以加上odd renderings (which was) attributed to the chinese. 翻译:这些传教士不正确的翻译应该对许多古怪的翻译负责,而不是把原因归功于中国人 。
attribute 它的发音怎么读音同“额吹biu特” 。
attribute 它的动词 和 名词 是不是读音不同?分别怎么读动词 attribute [D.J.:ə'tribju:t]
名词 attribution [ætrə'bju:ʃən]
attribute和property在英语里有什么区别Attribute 着重强调某个事物固有的属性,或区别于其他事物的特征,强调“专” 。从宏观上讲 , 比方说Car类,是什么颜色(Color);多大排量(Displacement);什么品牌(Brand)等,通过这些特征,可以区分出它是一辆什么样的汽车 。Property着重强调具有多少参数,或事物拥有的参数,不用它来特指某事物,只强调“有” 。在软件工程中比如properties配置文件,系统环境变量,系统配置参数等 。Attribue和Property从本义上讲,Attribute可翻译为属性,特征;而Property可翻译为属性,资产 。在UML中Property更倾向于宏观的属性描述或属性的统指,Attribute则指具体的类的属性 。
特点的英文怎么读

文章插图
feature 英 ['fiːtʃə(r)]美 ['fiːtʃər]n. 特征;特色;容貌;特写;故事片vt. 以 ... 为特色过去式: featured 过去分词: featured 现在分词: featuring 第三人称单数: features例句用作名词 (n.)1、Their candor is a very pleasing feature.他们的坦白是很愉快的特征 。2、Wet weather is a feature of life in this area.天气潮湿是这个地区生活的一个特色 。3、Her mouth is her best feature.她的嘴是她容貌上最好看的部分 。4、The local newspaper ran a feature on child labor.地方报纸登载一篇有关童工的特写 。用作及物动词 (vt.)1、This restaurant seems to feature vegetarian dishes.这家餐厅似乎以素菜为其特色 。词语用法v. (动词)1、名词feature的意思是“特色,特征”,转化为动词作“以…为特色,是…的特色”解,用作及物动词,接名词或代词作宾语 。2、feature作“占重要位置”解时,常用作不及物动词,其后接介词in,表示“在…中担任主角,占重要地位或起重要作用” 。3、feature还可作“刊载,展出”解,用作及物动词,接名词或代词作宾语 。扩展资料:近义词的用法attribute 英 ['ætrɪbjuːt]美 ['ætrɪbjuːt]vt. 把 ... 归于;n. 属性;标志;象征;特征形容词: attributable 名词: attributer 过去式: attributed 过去分词: attributed 现在分词: attributing 第三人称单数: attributes例句用作及物动词 (vt.)1、Most historians attribute such declines to wars and conquests.大多数的历史学家把这样的衰亡归于战争和征服 。2、Many people's success can be attributed to hard work and a bit of luck.很多人的成功都可以归于勤奋加上一点儿运气 。词语用法v. (动词)1、attribute用作动词的基本意思是“归因于”,指“把某事归因于某人〔某事〕”“认为某作品出自某人之手”“认为某事〔物〕属于某人〔物〕”,常用于attribute sth to sb/sth 结构 。n. (名词)2、attribute用作名词时的基本意思是“特性,属性”,指某人或某事所特有的性质或属性 。常与介词of连用,表示“是…的本性〔象征〕” 。
jsp中下面代码是什么意思?你这个不是JSP代码 , 这是JSP自定义标签中,xxx.tld文件的代码,是对JSP标签的定义 。
attribute是属性定义,
name表示属性名称
required表示该属性是否必须
jsp的attribute指令attribute只能在tag文件中才能使用,jsp不能用
jsp中getAttribute和setAttribute的详细解释?setAttribute("存的参数","想要存的值")就是把"想要存的值"放在"存的参数"里面.而getAttribute("存的参数")就是把刚才放在setAttribute()的值取出来..这个够直白了吧..
JSP中出现Undefined attribute name警告是什么原因?你这个变量应该是试图从request得到 , 但是request对象里没有你说的那个变量,在jsp页之前的servlet里应该要有setAttribute这个方法 , 把你想要获得的变量名称和值添加进去 request.setAttribute("name",value);value可以是任何对象 。也有可能一个错误是在之前的form表达所在的网页里有组件的value拼错了,和你现在jsp里的变量名不吻合 。你没把问题交代明白 。我能想到的可能性就这些了 。
jsp中属性和参数有什么区别JSP中的getParameter(Stringname)和getAttribute(Stringname)有何区别?
也就是Parameter(参数)和Attribute(属性)的区别?
在Java中有属性 和 方法之分,这个属性和Attribute(属性)是不是一样的?
参数就是方法中()里面的内容 , Parameter和这个参数一样吗?
HttpServletRequest类既有getAttribute()方法 , 也由getParameter()方法,这两个方法有以下区别:
(1)HttpServletRequest类有setAttribute()方法,而没有setParameter()方法
(2)当两个Web组件之间为链接关系时 , 被链接的组件通过getParameter()方法来获得请求参数,例如假定welcome.jsp和authenticate.jsp之间为链接关系 , welcome.jsp中有以下代码:
authenticate.jsp
或者:
请输入用户姓名:
在authenticate.jsp中通过request.getParameter( "username ")方法来获得请求参数username:
(3)当两个Web组件之间为转发关系时,转发目标组件通过getAttribute()方法来和转发源组件共享request范围内的数据 。假定authenticate.jsp和hello.jsp之间为转发关系 。authenticate.jsp希望向hello.jsp传递当前的用户名字,如何传递这一数据呢?先在authenticate.jsp中调用setAttribute()方法:
<%
Stringusername=request.getParameter( "username ");
request.setAttribute( "username ",username);
%>
在hello.jsp中通过getAttribute()方法获得用户名字:
Hello:
(4)从更深的层次考虑 , request.getParameter()方法传递的数据,会从Web客户端传到Web服务器端 , 代表HTTP请求数据 。request.getParameter()方法返回String类型的数据 。
request.setAttribute()和getAttribute()方法传递的数据只会存在于Web容器内部 , 在具有转发关系的Web组件之间共享 。这两个方法能够设置Object类型的共享数据 。
——getParameter得到的都是String类型的 。或者是http://a.jsp?id=123中的123,或者是某个表单提交过去的数据 。
——getAttribute则可以是对象 。
——getParameter()是获取POST/GET传递的参数值;
——getAttribute()是获取对象容器中的数据值;
——getParameter:用于客户端重定向时,即点击了链接或提交按扭时传值用,即用于在用表单或url重定向传值时接收数据用 。
——getAttribute:用于服务器端重定向时,即在sevlet中使用了forward函数,或struts中使用了mapping.findForward 。getAttribute只能收到程序用setAttribute传过来的值 。
另外,可以用setAttribute,getAttribute发送接收对象.而getParameter显然只能传字符串 。
setAttribute是应用服务器把这个对象放在该页面所对应的一块内存中去,当你的页面服务器重定向到另一个页面时,应用服务器会把这块内存拷贝另一个页面所对应的内存中 。这样getAttribute就能取得你所设下的值,当然这种方法可以传对象 。session也一样,只是对象在内存中的生命周期不一样而已 。
getParameter只是应用服务器在分析你送上来的request页面的文本时,取得你设在表单或url重定向时的值 。
distinguish与distribute的区别distinguish与distribute的区别具体如下:
distinguish英 [dɪˈstɪŋgwɪʃ]美 [dɪˈstɪŋɡwɪʃ]
vi.区分,辨别,分清;辨别是非
vt.区分,辨别,分清;辨别出,识别;引人注目,有别于;使杰出,使著名
例句:
Could he distinguish right from wrong?
他能分辨是非吗?
distribute英 [dɪˈstrɪbju:t]美 [dɪˈstrɪbjut]
vt.分配,散布;散发,分发;把…分类;[电]配电
例句:
Distribute the topping evenly over the fruit.
将配料均匀地撒在水果上 。
distribute分配 。这个词从构词词源上咋理解?和contribute一个意思吗?(谢谢 。)contribute: 意为“捐助;贡献”
distribute:意为“分配 , 散布; 散发 。
两个词意思不同 。
distribute是什么意思distribute 英[dɪˈstrɪbju:t]美[dɪˈstrɪbjut]vt. 分配,散布; 散发,分发; 把…分类; [电] 配电;[例句]Leaf veins distribute food and water throughout the leaf.叶脉把养料和水分分配给整张叶子 。[其他] 第三人称单数:distributes 现在分词:distributing 过去式:distributed 过去分词:distributed 形近词: attribute contribute
distribute是什么意思distribute英[dɪˈstrɪbju:t]美[dɪˈstrɪbjut]
vt.分配,散布; 散发,分发; 把…分类; [电] 配电;
[网络]散布; 分销; 分发;
[例句]Students shouted slogans and distributed leaflets.
学生们喊着口号,分发着传单 。
[其他]第三人称单数:distributes 现在分词:distributing 过去式:distributed过去分词:distributed 形近词: attribute contribute
attributeto和contributeto有什么区别attributeto
属性
contributeto
有助于
attribute什么意思属性特性把什么什么归因于
营销学里面Attribute Satisfactions 是什么意思 。营销只是我的副业 , 不过偶尔听到过这个概念 。
"Attribute Satisfactions":the consumer's subjective satisfaction judgment resulting from observations of attribute performance
意思是消费者对于(商品/服务)品质方面的满意程度 。
这个概念主要是针对在以客户为中心的营销管理过程中,用客户对品质特征的满意程度来衡量企业所创造的价值(Wertschoepfung) 。德语中对应的应该是"Attributzufriedenheit"这个词 。
"Disconfirmation"应该也是与这个知识点有关的一个词,意为“失验”,指事前与事后认知的差距 。比方说公司对客户的满意度事先有一个期待值(Erwartungen),经过实际调查后会得到客户的实际评价(Erfahrungen),如果期待值和实际评价相等,则称为"Confirmation" 。如果事前期待小于实际评价,即实际绩效高于预期绩效,说明顾客会感到满意,则称为"positive Disconfirmation" 。德语里面用的也是这两个词,没有区别 。你可能听过SollLeistung和IstLeistung这两个说法 。通过比较这两个值 , 得出结论 。
Positive Disconfirmation (Ist > Soll)
Confirmation (Ist = Soll)
Negative Disconfirmation (Ist < Soll)
具体的衡量比较方法你可以看一下这里:
http://74.125.153.132/search?q=cache:E6_Qx5sqYDsJ:www.juergen-schmitz-consulting.de/wertschoepfung_und_evaluation.htm+ereignisorientierte+merkmalorientierte+messung&cd=1&hl=de&ct=clnk&gl=de
或者在google.de输入"ereignisorientierte und merkmalorientierte Verfahren"查找一下 。
请问斯巴鲁广告片的内涵是什么?斯巴鲁新广告片应该是比较艺术的去传递 “我行我路”的精神,走自己的路,走出自己的风格,冯小刚是一个有个性有自己风格的导演,他在纸上描绘着一种场景,一种设想 , 无论他描绘出怎样的圈圈折折,在他的脑海中 , 总有这样一个画面:他开着自己的斯巴鲁沿着自己描绘的“路线”来到了最终想要到达的那个地方……这就是冯小刚或者说斯巴鲁想表达的我行我路,走自己路线的精神 。
其实,广告片都会有些艺术性和夸张性,所以楼主不必刻意去纠结与想要找到每一个细节的含义与具体答案,有些内容是只可意会不可言传的,需要楼主用心去体会,也许你会豁然开朗~~~~
net 定义什么接口能够attribute接口是某类行为或功能的抽象,是一种规范或者标准,或者说是一种契约 。所以从字面上理解就非常清楚了,西方神话中有很多和魔鬼定下契约来使自己的力量得到提升的故事,你必须定下这个契约才能得到你想要的力量 。
C#中类似 [AttributeUsage(AttributeTargets.Field)]这种在两边加 [ 类名] 的用法是什么用法?。?/h3>C# 中 这个叫做特性 , 可以通过反射拿到详情请见MSDNhttp://msdn.microsoft.com/zh-cn/library/z0w1kczw.aspx
这种写法‘[]’中内容起什么作用,在程序中有什么实际意义吗特性(attribute)是被指定给某一声明的一则附加的声明性信息 。在C#中,有一个小的预定义特性集合 。在学习如何建立我们自己的定制特性(custom attributes)之前,我们先来看看在我们的代码中如何使用预定义特性 。using System; public class AnyClass {[Obsolete("Don't use Old method, use New method", true)]static void Old( ) { }static void New( ) { }public static void Main( ){Old( );} }在这个例子中我们使用了Obsolete特性 , 它标记了一个不应该再被使用的程序实体 。第一个参数是一个字符串,它解释了为什么该实体是过时的以及应该用什么实体来代替它 。实际上,你可以在这里写任何文本 。第二个参数告诉编译器应该把使用这个过时的程序实体当作一种错误 。它的默认值是false,也就是说编译器对此会产生一个警告 。当我们尝试编译上面这段程序的时候,我们将会得到一个错误:AnyClass.Old()' is obsolete: 'Don't use Old method, use New method'开发定制特性(custom attributes)现在让我们来看看如何开发我们自己的特性 。首先我们要从System.Attribute派生出我们自己的特性类(一个从System.Attribute抽象类继承而来的类,不管是直接还是间接继承,都会成为一个特性类 。特性类的声明定义了一种可以被放置在声明之上新的特性) 。using System; public class HelpAttribute : Attribute { }//不管你是否相信,我们已经建立了一个定制特性,现在我们可以用它来装饰现有的类就好像上面我们使用Obsolete attribute一样 。[Help()] public class AnyClass { }注意:对一个特性类名使用Attribute后缀是一个惯例 。然而,当我们把特性添加到一个程序实体,是否包括 Attribute后缀是我们的自由 。编译器会首先在System.Attribute的派生类中查找被添加的特性类 。如果没有找到,那么编译器会添加 Attribute后缀继续查找 。到目前为止,这个特性还没有起到什么作用 。下面我们来添加些东西给它使它更有用些 。using System; public class HelpAttribute : Attribute {public HelpAttribute(String Descrition_in){this.description = Description_in;}protected String description;public String Description{get{return this.description;}} } [Help("this is a do-nothing class")] public class AnyClass { }在上面的例子中,我们给HelpAttribute特性类添加了一个属性并且在后续的部分中我们会在运行时环境中查寻它 。定义或控制特性的使用AttributeUsage类是另外一个预定义特性类,它帮助我们控制我们自己的定制特性的使用 。它描述了一个定制特性如和被使用 。AttributeUsage有三个属性,我们可以把它放置在定制属性前面 。第一个属性是:ValidOn通过这个属性,我们能够定义定制特性应该在何种程序实体前放置 。一个属性可以被放置的所有程序实体在AttributeTargets enumerator中列出 。通过OR操作我们可以把若干个AttributeTargets值组合起来 。AllowMultiple这个属性标记了我们的定制特性能否被重复放置在同一个程序实体前多次 。Inherited我们可以使用这个属性来控制定制特性的继承规则 。它标记了我们的特性能否被继承 。下面让我们来做一些实际的东西 。我们将会在刚才的Help特性前放置AttributeUsage特性以期待在它的帮助下控制Help特性的使用 。using System; [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class HelpAttribute : Attribute {public HelpAttribute(String Description_in){this.description = Description_in;}protected String description;public String Description{get{return this.description;}} }先让我们来看一下AttributeTargets.Class 。它规定了Help特性只能被放在class的前面 。这也就意味着下面的代码将会产生错误:[Help("this is a do-nothing class")] public class AnyClass {[Help("this is a do-nothing method")] //errorpublic void AnyMethod(){} }编译器报告错误如下:AnyClass.cs: Attribute 'Help' is not valid on this declaration type.It is valid on 'class' declarations only.我们可以使用AttributeTargets.All来允许Help特性被放置在任何程序实体前 。可能的值是:Assembly,Module,Class,Struct,Enum,Constructor,Method,Property,Field,Event,Interface,Parameter,DelegateAll = Assembly | Module | Class | Struct | Enum | Constructor | Method | Property | Field | Event | Interface | Parameter | DelegateClassMembers = Class | Struct | Enum | Constructor | Method | Property | Field | Event | Delegate | Interface下面考虑一下AllowMultiple = false 。它规定了特性不能被重复放置多次 。[Help("this is a do-nothing class")] [Help("it contains a do-nothing method")] public class AnyClass {[Help("this is a do-nothing method")] //errorpublic void AnyMethod(){} } 它产生了一个编译期错误 。AnyClass.cs: Duplicate 'Help' attributeOk,现在我们来讨论一下最后的这个属性 。Inherited, 表明当特性被放置在一个基类上时,它能否被派生类所继承 。[Help("BaseClass")] public class Base { } public class Derive : Base { }这里会有四种可能的组合: 1 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 2 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 3 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 4 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]第一种情况:如果我们查询(Query)(稍后我们会看到如何在运行期查询一个类的特性)Derive类,我们将会发现Help特性并不存在,因为inherited属性被设置为false 。第二种情况:和第一种情况相同,因为inherited也被设置为false 。第三种情况:为了解释第三种和第四种情况 , 我们先来给派生类添加点代码:[Help("BaseClass")] public class Base { } [Help("DeriveClass")] public class Derive : Base { }现在我们来查询一下Help特性 , 我们只能得到派生类的属性,因为inherited被设置为true,但是AllowMultiple却被设置为false 。因此基类的Help特性被派生类Help特性覆盖了 。第四种情况:在这里,我们将会发现派生类既有基类的Help特性,也有自己的Help特性 , 因为AllowMultiple被设置为true 。定义或控制特性的使用AttributeUsage类是另外一个预定义特性类 , 它帮助我们控制我们自己的定制特性的使用 。它描述了一个定制特性如何被使用 。属性和特性的区别可以参考一下: http://developer.51cto.com/art/200908/147097.htm本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Foxalien/archive/2009/12/05/4946672.aspx
c# Attribute 怎么用假设你的F()方法是定义在下面这个类里面:
public class MyClass
{
[IStudent(Name = "abc", Age = 20)]
public void F()
{
}
}
那么可以这么去取值:
Type type = typeof(MyClass);
MethodInfo methodInfo = type.GetMethod("F");
if (methodInfo.IsDefined(typeof(IStudentAttribute), false))
{
object[] attributes = methodInfo.GetCustomAttributes(typeof(IStudentAttribute), false);
IStudentAttribute studentAttr = (IStudentAttribute)attributes[0];
Console.WriteLine(studentAttr.Name + studentAttr.Age);
}
实际上 , Attribute可以有很多用处,比如说 , 你可以在某个方法上做标记看有没有权限调用,或者在某个属性上标记,看要如何校验 。例如(实在习惯用var关键字了 , 下面的代码都用var了,还有Linq):
假设我们有这么一个标记来说明操作的权限:
///
/// 声明权限的标记
///
[AttributeUsage(AttributeTargets.Method)]
public class PermissonAttribute : Attribute
{
public string Role { get; set; }
public PermissonAttribute(string role)
{
this.Role = role;
}
public PermissonAttribute()
{
}
}
有一个操作类应用了该标记:
///
/// 文件操作类
///
public class FileOperations
{
///
/// 任何人都可以调用Read
///
[Permisson("Anyone")]
public void Read()
{
}
///
/// 只有文件所有者才能Write
///
[Permisson("Owner")]
public void Write()
{
}
}
然后我们写一个工具类来检查操作权限
///
/// 调用操作的工具类
///
public static class OperationInvoker
{
public static void Invoke(object target, string role, string operationName, object[] parameters)
{
var targetType = target.GetType();
var methodInfo = targetType.GetMethod(operationName);
if (methodInfo.IsDefined(typeof(PermissonAttribute), false))
{
// 读取出所有权限相关的标记
var permissons = methodInfo
.GetCustomAttributes(typeof(PermissonAttribute), false)
.OfType();
// 如果其中有满足的权限
if (permissons.Any(p => p.Role == role))
{
methodInfo.Invoke(target, parameters);
}
else
{
throw new Exception(string.Format("角色{0}没有访问操作{1}的权限!", role, operationName));
}
}
}
}
最后 , 在使用的时候:
var role = "Anyone";
var opertion = new FileOperations();
// 可以正常调用Read
OperationInvoker.Invoke(operation, "Read", null);
// 但是不能调用Write
OperationInvoker.Invoke(operation, "Write", null);
C# 设置 AttributeUsageAttributeTargets 枚举
成员名称 说明
All 可以对任何应用程序元素应用属性 。
Assembly 可以对程序集应用属性 。
Class 可以对类应用属性 。
Constructor 可以对构造函数应用属性 。
Delegate 可以对委托应用属性 。
Enum 可以对枚举应用属性 。
Event 可以对事件应用属性 。
Field 可以对字段应用属性 。
GenericParameter 可以对泛型参数应用属性 。
Interface 可以对接口应用属性 。
Method 可以对方法应用属性 。
Module 可以对模块应用属性 。注意
Module 指的是可移植的可执行文件(.dll 或 .exe) , 而非 Visual Basic 标准模块 。
Parameter 可以对参数应用属性 。
Property 可以对属性 (Property) 应用属性 (Attribute) 。
ReturnValue 可以对返回值应用属性 。
Struct 可以对结构应用属性 , 即值类型
下面的代码示例演示如何应用 AttributeTargets 枚举:
using System;
namespace AttTargsCS {
// This attribute is only valid on a class.
[AttributeUsage(AttributeTargets.Class)]
public class ClassTargetAttribute : Attribute {
}
// This attribute is only valid on a method.
[AttributeUsage(AttributeTargets.Method)]
public class MethodTargetAttribute : Attribute {
}
// This attribute is only valid on a constructor.
[AttributeUsage(AttributeTargets.Constructor)]
public class ConstructorTargetAttribute : Attribute {
}
// This attribute is only valid on a field.
[AttributeUsage(AttributeTargets.Field)]
public class FieldTargetAttribute : Attribute {
}
// This attribute is valid on a class or a method.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method)]
public class ClassMethodTargetAttribute : Attribute {
}
// This attribute is valid on any target.
[AttributeUsage(AttributeTargets.All)]
public class AllTargetsAttribute : Attribute {
}
[ClassTarget]
[ClassMethodTarget]
[AllTargets]
public class TestClassAttribute {
[ConstructorTarget]
[AllTargets]
TestClassAttribute() {
}
[MethodTarget]
[ClassMethodTarget]
[AllTargets]
public void Method1() {
}
[FieldTarget]
[AllTargets]
public int myInt;
static void Main(string[] args) {
}
}
}
如何获取类或属性的自定义特性1. 定义一个以Attribute结尾的特性类, 特性类继承自System.Attribute, 如下所示.
[AttributeUsage(AttributeTargets.Property, AllowMultiple=false)]
public class PrimaryKeyAttribute : System.Attribute
{
.............
其中AttributeTargets是一个枚举的值, 可以是: Assembly | Module | Class | Struct | Enum | Constructor | Method | Property | Field | Event | Interface | Parameter | Delegate
2. 在需要使用的地方使用PrimaryKey自定义特性标签, 如下所示.
[PrimaryKey(Column = "CustomerID", IsIdentity=false)]
public int ID
{
.............
3. 为了获取自定义特性的信息, 需要反射的方式获取其数据, 首先我们定义一个类来存储这些信息, 如下所示
public class PrimaryKeyModel
{
private readonly PropertyInfo propertyInfo;//外键的属性字段信息
private readonly PrimaryKeyAttribute primaryKeyAtt;//外键的特性信息
................
public static PrimaryKeyModel GetPrimaryKey(Type type)
{
PropertyInfo[] properties = type.GetProperties();
foreach (PropertyInfo p in properties)
{
object[] keys = p.GetCustomAttributes(typeof(PrimaryKeyAttribute), true);
if (keys.Length == 1)
{
return new PrimaryKeyModel(p, keys[0] as PrimaryKeyAttribute);
}
}
return null;
}
4. 在Customer类中获取其特性的信息代码如下
string strReturn = string.Empty;
//Get PrimaryKey Name
PrimaryKeyModel attribute= PrimaryKeyModel.GetPrimaryKey(this.GetType());
if(attribute != null)
{
strReturn += string.Format("PrimaryKey Name:{0} IsIdentity:{1} Column:{2}\r\n",
attribute.Property.Name, attribute.PrimaryKeyAtt.IsIdentity, attribute.PrimaryKeyAtt.Column);
}
attribute to怎么用?attribute to
1. 多亏;把(某事物)归因于(或归功于);认为是…的结果:
She attributes her great age to carefully planned diet.
她认为她的高寿是精心安排饮食的结果 。
2. 认为是…所有(或所作):
to attribute a painting to an artist.
认为这幅画是一名画家画的
3. 认为(品性、品质、特征)属于…:
We attribute courage to the lion and cunning to the fox.
我们认为狮子勇敢而狐狸却狡黠 。
4. 确定…产生的时间、时期或地点等:
to attribute a discovery to a particular country
确定一个发现源于某国
be attributed to 和attribute to分别怎么翻译!原因在前还是结果在前!!

文章插图
1、sb. attribute A to B , 把A看作B的结果,归因于 。2、A is attributed to B,A是结果,B是原因 。一、be attributed to1、读音:英 [bi əˈtrɪbjuːtɪd tu]美 [bi əˈtrɪbjuːtɪd tu]2、释义:被认为是…所为 。3、语法:attribute用作动词的基本意思是“归因于”,指“把某事归因于某人〔某事〕”“认为某作品出自某人之手”“认为某事〔物〕属于某人〔物〕”,常用于attribute sth to sb/sth 结构 。二、attribute to1、读音:英 [əˈtrɪbjuːt tu]美 [əˈtrɪbjuːt tu]2、释义:把某事归因于某人(某事) 。3、语法:attribute用作名词时的基本意思是“特性,属性”,指某人或某事所特有的性质或属性 。常与介词of连用 , 表示“是…的本性〔象征〕” 。扩展资料近义词:ascribe1、读音:英 [əˈskraɪb]美 [əˈskraɪb]2、释义:把…归因于 。3、语法:ascribe的基本意思是“把…归于”,可指好的事情,也可指坏的事情 。ascribe通常与介词to搭配,表示“把…归于…”或“认为…属于…” 。可用于被动结构 。4、用法例句:It's wrong to ascribe all that have happen simply to the war. 5、白话译文:把发生的一切归咎于战争是错误的 。
attribute to 和 contribute to 有什么区别啊?1.把...归因于,是...的结果attribute to outside causes.由于外因引起2.是...所有remarks attribute to the chief constable来自警察局长的评论contribute to1.捐献contribute to the Red Cross向红十字会捐献2.有助于,为...出力适当的休息和足够的睡眠有益于长寿 。
attribute to 后面跟do还是doingattribute to do.把...归因于,是...的结果
attribute to后面可以跟that从句吗?【attribute】可以,但是在attribute to 和that 之间需要有 宾语
- dialogue
- 孩子睡觉出汗 孩子张嘴睡觉是什么原因
- 男人闷骚是好还是坏 闷骚男是什么意思啊
- 慷慨激昂的意思
- 玩玉最烦的事是什么?
- 各类英文缩写英语达人必备 wanna是什么意思
- 粉丝是什么意思
- 一劳永逸的意思
- 断片是什么意思
- cio是什么意思
