⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 24.2.htm

📁 This ECMA Standard specifies the form and establishes the interpretation of programs written in the
💻 HTM
📖 第 1 页 / 共 2 页
字号:
</pre>end example]</span> </span><span class="locator">
     Paragraph 8</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P8S1"></a>It is a compile-time error to use a single-use attribute class more than once on the same entity.</span> <span class="example">[Example: The example <pre class="code-example">
using System;  
[AttributeUsage(AttributeTargets.Class)]  
public class HelpStringAttribute: Attribute  
{  
   string value;  
   public HelpStringAttribute(string value) {  
      this.value = value;  
   }  
   public string Value { get {...} }  
}  
[HelpString("Description of Class1")]  
[HelpString("Another description of Class1")]  
public class Class1 {}  
</pre>results in a compile-time error because it attempts to use HelpString, which is a single-use attribute class, more than once on the declaration of Class1. end example]</span> </span><span class="locator">
     Paragraph 9</span><span class="paragraph"><span class="sentence"><span class="sentence-number">1</span> <a name="P9S1"></a>An expression E is an <span class="non-terminal"><a href="24.2.htm#attribute-argument-expression">attribute-argument-expression</a></span> if all of the following statements are true: </span><ul><li><span class="sentence"><span class="sentence-number">2</span> <a name="P9S2"></a> The type of E is an attribute parameter type (<a href="24.1.3.htm">&#167;24.1.3</a>).</span> </li><li><span class="sentence"><span class="sentence-number">3</span> <a name="P9S3"></a> At compile-time, the value of E can be resolved to one of the following: </span></li><ul><li><span class="sentence"><span class="sentence-number">4</span> <a name="P9S4"></a> A constant value.</span> </li><li><span class="sentence"><span class="sentence-number">5</span> <a name="P9S5"></a> A System.Type object.</span> </li><li><span class="sentence"><span class="sentence-number">6</span> <a name="P9S6"></a> A one-dimensional array of <span class="non-terminal"><a href="24.2.htm#attribute-argument-expression">attribute-argument-expression</a></span>s.</span> </li></ul></ul></span><span class="paragraph"><span class="example">[Example: For example: <pre class="code-example">
using System;  
[AttributeUsage(AttributeTargets.Class)]  
public class MyAttribute: Attribute  
{  
   public int P1 {  
      get {...}  
      set {...}  
   }  
   public Type P2 {  
      get {...}  
      set {...}  
   }  
   public object P3 {  
      get {...}  
      set {...}  
   }  
}  
[My(P1 = 1234, P3 = new int[]{1, 3, 5}, P2 = typeof(float))]  
class MyClass {}  
</pre>end example]</span> </span><span class="ruler"></span><table><tr><td><table align="left" bgcolor="navy"><tr bgcolor="navy"><td><font face="Arial,sans-serif" size="6" color="yellow"><strong>{ JSL }</strong></font></td></tr></table></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>Jagger Software Ltd</strong></font></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>Company # 4070126</strong></font></td></tr><tr><td><font face="Arial,sans-serif" size="2" color="navy"><strong>VAT # 762 5213 42</strong></font></td></tr></table><img src="valid-html401.png" align="left" height="31" width="88" alt="Valid HTML 4.01" /><img src="vcss.gif" align="left" height="31" width="88" alt="Valid CSS" /></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -