KeywordAttribute Class

Description

Specifies that a method is a keyword. If the name of the keyword is not specified the name of the annotated method is used as the keyword name.

Syntax

C#
[AttributeUsageAttribute(AttributeTargets.Method)]
public class KeywordAttribute : Attribute
VB
'Declaration
<AttributeUsageAttribute(AttributeTargets.Method>
Public Class KeywordAttribute Inherits Attribute

Properties

Name Description
Name Property (KeywordAttribute) Gets the name of the keyword. The default value is an empty string.
Description Property (KeywordAttribute) Gets the description of the keyword. The default value is an empty string.

Example: Creating a keyword with two arguments

Use the following code sample to create the keyword Login with the arguments username and password:

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

Example: Specifying a keyword name

To specify the keyword name when creating a new keyword, use the following code sample:

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