List Info

Thread: Ho to pass optional parameter in c#




Ho to pass optional parameter in c#
user name
2006-07-18 11:23:12

Expalin Plz  >>> Do u Mean OverLoad Function ??

rkmnm <rkmnmyahoo.com&gt; wrote:

HI

can any one tell me how to pass optional Parameter in c#.

Plz Help me how to pass it.

Thanks

Ravi Mittal


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__._,_.___
.

__,_._,___
Ho to pass optional parameter in c#
user name
2006-07-18 16:58:13

hi,
i think u mean passing optional parameter in method, if that
 
you can use keyword optional before the data type of the variable that entire method parameter.

geme_ 3030 <geme_3030yahoo.com&gt; wrote:
Expalin Plz  >>&gt; Do u Mean OverLoad Function ??

rkmnm <rkmnmyahoo.com&gt; wrote:
HI

can any one tell me how to pass optional Parameter in c#.

Plz Help me how to pass it.

Thanks

Ravi Mittal


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



Warm wishes,
Mohamed Rady
MCP, MCAD, MCSD
Solution Developer
IT Instructor
 
Development skills = Intelligence Is All About Reading;

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__._,_.___
.

__,_._,___
Ho to pass optional parameter in c#
user name
2006-07-18 18:34:47

Hiya,

 

This would be an example:

public void SayHello(String name)

{

 &nbsp; &nbsp; &nbsp; &nbsp;   ; MessageBox.Show(name);

}

 

public void SayHello(String name, String name2)

{

 &nbsp; &nbsp; &nbsp; &nbsp;   ; MessageBox.Show(name&#43;”\n”&#43;name2);

}

 

public void SayHello(String name, String name2, String name3)

{

 &nbsp; &nbsp; &nbsp; &nbsp;   ; MessageBox.Show(name+\n”&#43;name23;”\n”+;name3);

}

 

Notice I use the same method name and just add extra parameters. This is referred to as overloading in the C# language.

 

 

Kind Regards,

Robert A Heeley

rahsoftware.com">Rob.Heeleyrahsoftware.com

http://www.rahsoftware.com

0770 4121168

 

The contents of this message, including any attachments, are confidential and are intended solely for the use of the person or entity to whom the message was addressed. If you are not the intended recipient of this message, please be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify the sender. Please also permanently delete all copies of the original message and any attached documentation. Thank you.


From: Microsofts_C_Sharp@yahoogroups.com [mailto:Microsofts_C_Sharp@yahoogroups.com] On Behalf Of geme_ 3030
Sent: 18 July 2006 12:23
To: Microsofts_C_Sharp@yahoogroups.com
Subject: Re: [Microsofts_C_Sharp] Ho to pass optional parameter in c#

 

Expalin Plz  >>&gt; Do u Mean OverLoad Function ??

rkmnm <rkmnmyahoo.com&gt; wrote:

HI

can any one tell me how to pass optional Parameter in c#.

Plz Help me how to pass it.

Thanks

Ravi Mittal

 

 __________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__._,_.___
.

__,_._,___
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )