Generating a Property Stub | Get Ready For C# 4.0

Posted by Tarek N. Elsamni | Posted in | Posted on 02:46

0

If code references an undefined property, click Generate property stub. The property stub is generated in the appropriate class. The property’s return type is determined from the context.

For example, assume that you generate the InstanceProperty property from the statement in the following code.


When you generate the property, the following stub is created in the Customer class.


If a property is invoked on a type and not an instance, the generated stub will be a static property (C#) or a shared property (Visual Basic).

For example, imagine that you generate a property from the following statement (assuming that Customer is a class name).



When you generate the property, the following stub is created in the Customer class.


If a property is invoked without a qualification (referring to a member of the current type), the generated stub is static if the property is called from a static method. Otherwise, it is an instance property.

For example, assume that you generate a property from the following statement.


When you generate the property, the following stub is created in the current class.

Comments (0)

Post a Comment