|
-
Nov 22nd, 2002, 03:58 PM
#1
Thread Starter
yay gay
how to make a vb's "optional" in a function
how do i make that in c#?
\m/  \m/
-
Nov 22nd, 2002, 04:01 PM
#2
Frenzied Member
as far as i am aware of this feature its not available...
but there is a better way
overload the function
private void func1(int blah)
{
}
private void func1()
{
}
-
Nov 22nd, 2002, 04:01 PM
#3
Thread Starter
yay gay
\m/  \m/
-
Nov 22nd, 2002, 04:16 PM
#4
Frenzied Member
function overloading is much better of course
optional parameters are for wussies
-
Nov 22nd, 2002, 04:28 PM
#5
Thread Starter
yay gay
imagine i have a function with 100 lines(well it has only 4 but it could have more ) and i want 2paramenters to be optional..then i'd instead of having 100 lines of code have 300 lines..its a bit much no? lol
\m/  \m/
-
Nov 22nd, 2002, 06:03 PM
#6
Addicted Member
private void func1(int blah)
{
My200LinesoCode(blah)
}
private void func1()
{
My200LinesofCode(0)
}
private void My200LinesofCode(int blahblah)
{
}
This is how I get around it. In the second overload just call your real code and pass whatever you wanted the optional default value to be. Hope this helps.
Last edited by MasterBlaster; Nov 22nd, 2002 at 06:07 PM.
-
Nov 22nd, 2002, 07:10 PM
#7
Thread Starter
yay gay
tks ive already though of that
\m/  \m/
-
Nov 22nd, 2002, 07:57 PM
#8
Addicted Member
"Well Heeelllooo Mr Fancy Pants!"
-
Nov 22nd, 2002, 08:10 PM
#9
Thread Starter
yay gay
\m/  \m/
-
Nov 25th, 2002, 12:13 PM
#10
Addicted Member
Sorry, I rented the Movie "Army Of Darkness" that day and have been spewing out cheesey lines from it all weekend.
-
Nov 25th, 2002, 05:23 PM
#11
Thread Starter
yay gay
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|