説明
メソッドがキーワードであることを指定します。キーワードの名前が指定されていない場合、アノテーション メソッドの名前がキーワード名として使用されます。
構文
C#
[AttributeUsageAttribute(AttributeTargets.Method)]
public class KeywordAttribute : Attribute
VB'Declaration
<AttributeUsageAttribute(AttributeTargets.Method>
Public Class KeywordAttribute Inherits Attribute
例:2 つの引数を持つキーワードの作成
引数 username および password を持つ Login キーワードを作成するには、次のサンプル コードを使用します。
C#
[Keyword]
public void Login(string username, string password) {
// keyword implementation
}
VB<Keyword()>
Public Sub Login(username As String, password As String)
' keyword implementation
End Sub
例:キーワードの名前の指定
新しいキーワードを作成するときにキーワードの名前を指定するには、次のサンプル コードを使用します。
C#
[Keyword("Login user")]
public void Login(string username, string password) {
// keyword implementation
}
VB<Keyword("Login user")>
Public Sub Login(username As String, password As String)
' keyword implementation
End Sub