This documentation is archived and is not being maintained.

9.7.2 Set Accessor Declarations

Visual Studio .NET 2003

A Set accessor (setter) is declared by using a property set declaration. A property set declaration consists of the keyword Set, an optional parameter list, and a statement block. Given a property named P, a setter declaration implicitly declares a method with the name set_P with the same modifiers and parameter list as the property. If the type contains a declaration with that name, a compile-time error results.

If a parameter list is specified, it must have one member, that member must have no modifiers except ByVal, and its type must be the same as the type of the property. The parameter represents the property value being set. If the parameter is omitted, a parameter named Value is implicitly declared.

PropertySetDeclaration ::=
   [ Attributes ] Set [ ( ParameterList ) ] LineTerminator
   [ Block ]
   End Set

See Also

9.7.1 Get Accessor Declarations | 9.7.3 Default Properties | 9.7 Properties | Setting and Retrieving Properties (Visual Basic Language Concepts)

Show: