Show/Hide Toolbars

XSharp

Purpose

Declare a method to access a non-exported or virtual instance variable.

Syntax

 [Attributes] [Modifiers] EVENT<idName>

 [AS <idType>] [<idConvention>]CRLF

 [

             [ REMOVE <Expression> ]  [ADD <Expression>]

             | [ ADD <Body > END ADD]

   | [ ADD => <expression>]

   | [REMOVE <Body > END REMOVE]

             | [REMOVE => <expression>]

   END EVENT

             ]

Arguments

AttributesAn optional list of one or more attributes that describe meta information for am entity, such as for example the [TestMethod] attribute on a method/function containing tests in a MsTest class library. Please note that Attributes must be on the same line or suffixed with a semi colon when they are written on the line above that keyword.

 

<idName>A valid identifier name for the event that you are defining.  Like other methods, events are entities. Event names must be unique within a class, but can share the same name as other entities in your application.

 

AS <idType>Specifies the data type.  If omitted, then depending on the compiler options the type will be either USUAL or determined by the compiler.

 

<Expression>Expression that implements the accessor

 

=> <Expression>Single expression that replaces the multiline body for the entity. CANNOT be compiled with a body

 

<Body>Program statements that form the code of this entity.
The <Body> can contain one or more RETURN statements to return control to the calling routine and to serve as the function return value.  If no return statement is specified, control passes back to the calling routine when the function definition ends, and the function will return a default value depending on the return value data type specified (NIL if the return value is not strongly typed).
CANNOT be combined with an Expression Body

 

 

Description

 

There are 3 types of event declarations:

Single line declaration without ADD / REMOVE accessors

Single line declaration with ADD / REMOVE accessors

Multi line declaration with ADD accessor block and/or REMOVE accessor bock

See Also

ASSIGN, CLASS, METHOD