-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: aamirOnline
Message 1 in Discussion
Hi
If you are creating component or library, then you have to consider many aspects of
component development. One of the aspects is trying to provide a feature, which is not
supported by the language in which components or library is being created. One of such
thing is creating optional method parameters in C#, Languages like VB.Net natively
supports such kind of parameters. So if you want to create optional method parameters
in C# for VB.Net here is the way out.
<o:p></o:p>
In the namespace System.Runtime.InteropServices there is a one attribute defined,
OptionalAttribute Just apply it to the argument you want to make as optional. That�s
it�
<o:p></o:p>
For example�
<o:p></o:p>
public string GetName([Optional]string param)<o:p></o:p>
{<o:p></o:p>
if (param == null) //Check for null.<o:p></o:p>
param = "Aamir"; //Set the default value.<o:p></o:p>
return param;<o:p></o:p>
}
<o:p></o:p>
Any yes, remember for C# optional parameters are not optional�
Regards
M. Aamir Maniar [Blogs]
<o:p></o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]