Tuesday, May 17, 2011

C# Method Wizard


Add a method and define its elements using the one-page C# Method Wizard.
Method access
Sets the access to the method. Access modifiers are keywords for setting access to the method. Specify the access other classes have to the method. The method access level is set to public by default. The following access levels are available: See Accessibility Levels for an overview of these five levels and for more information about specifying access for methods.
Return type
Sets the value type that the method returns in the return statement. The return type is set to void by default. For more information about C# return types, see Value Typesand Built-in Types Table.The following value types are available:
Method name
Sets the name of the method to add to the class. You must add at least the method name.
Modifier
Sets the parameter's modifier. Modifier is set to None by default. See Method Parameters for more information.
Parameter type
Sets the type for the Parameter name. The parameter type is set to int by default. The type is reflected in the Method signature box at the bottom of the wizard. The same values available for the return type are available for the parameter type, with the exception of void.
Parameter name
Sets the name of a parameter to pass through your method. After typing the name, you must click Add to add it to the list of parameters that will pass through your method.If you do not provide a parameter name, the wizard ignores any Modifier or Parameter type selections. Once you click Add, the parameter name appears in Parameter list and in Method signature at the bottom of the wizard. If you supply a parameter name and then click Finish before you click Add, the parameter is not added to the method. You must find the method and insert the parameter manually.
Add
Adds the parameter you specify in Parameter name, and its modifier and type, to the Parameter list and displays the complete parameter in the Method signature box at the bottom of the wizard. You must click Add to add a parameter to the list.
Remove
Removes the parameter you select in Parameter list from the list and from the Method signature box at the bottom of the wizard.
Parameter list
Displays all parameters and their modifiers and types currently added for the method. As you add parameters, the wizard updates the Parameter list to display each parameter, with its modifier and type.
Method modifiers
Modifies the declarations of types and type members. By default, no modifiers are included. Using this wizard, you can add the following modifiers.
Modifier optionDescription
StaticThe method belongs to the type itself rather than to a specific object.
AbstractThe method is a member of an abstract class. If the class to which you are adding the method is not abstract, this option is not available. See C# Class Wizard for more information.
VirtualThe method's implementation can be changed by an overriding member in a derived class.
ExternAdvanced. The method is implemented externally.
OverrideAdvanced. Provide a new implementation of a virtual member inherited from a base class.
NewAdvanced. Explicitly hides a member inherited from a base class. To hide an inherited member, declare it in the derived class using the same name, and modify it with the new modifier.
You can combine certain modifiers; however, some modifiers are mutually exclusive. For example, you can set your modifiers to new virtualextern static or override abstract. The following combinations of options are not allowed:
ModifierCannot combine with ...
staticvirtualabstract, and override
virtualstaticabstract, and override
overridenewstatic, and virtual
abstractvirtual and static
newoverride
externabstract
Depending on your modifier selection, check boxes appear dimmed for excluded combinations.
Comment
Provides a short description to the method. Comments are converted into XML documentation and encapsulated by <summary> tags, which are used to provide the descriptions.
Method signature
Displays the method as it is added to your code when you click Finish. You cannot edit the text in this box. To change the method, change the appropriate fields in the wizard.

No comments:

Post a Comment

Thank you for Commenting Will reply soon ......

Featured Posts

#Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc

 #Linux Commands Unveiled: #date, #uname, #hostname, #hostid, #arch, #nproc Linux is an open-source operating system that is loved by millio...