Optional argument in C# ???

  • Thread starter Thread starter tiger79
  • Start date Start date
T

tiger79

Hi,
I would like to know if there exists something like the Optional argument in
VB for C# ???
thanx...
 
I'd also like to know about the Collection as a type.
Can't seem to find one in C3, I did find the ArrayList, i guess this can be
used as a Collection in VB ???

About the optional argument, I did find out that there is no such thing, but
doesn't something similar exist ???

Thanx...
 
About the optional argument, I did find out that there is no such thing, but
doesn't something similar exist ???

Overloading - same function names, different arguments. E.g.

function testFunc()
{

{

function testFunc(string strTest)
{

}

function testFunc(string strTest, int intTest)
{

}
 
tiger79wrote:
I'd also like to know about the Collection as a type.
Can't seem to find one in C3, I did find the ArrayList, i guess this can be
used as a Collection in VB ???

There are a number of collections in .NET, such as NameValueCollection
which is pretty close to the VB Collection. However, to play it safe
you can still use the Microsoft.VisualBasic.Collection - it is part
of .NET and if you don't feel like rewriting everything at once, this
is a good option. (but many on this group feel very strongly about
not using anything from the .NET Microsoft.VisualBasic namespace, by
the way).
 
PseudoBill said:
There are a number of collections in .NET, such as NameValueCollection
which is pretty close to the VB Collection. However, to play it safe
you can still use the Microsoft.VisualBasic.Collection - it is part
of .NET and if you don't feel like rewriting everything at once, this
is a good option. (but many on this group feel very strongly about
not using anything from the .NET Microsoft.VisualBasic namespace, by
the way).

I certainly feel strongly about not using things from the
Microsoft.VisualBasic namespace just for the sake of avoiding learning
..NET collections. If there are things in the Microsoft.VisualBasic
namespace which don't have any natural .NET equivalent, that's one
thing - but to go out of your way to use what is essentially emulation
of a VB type when there's a type with equivalent functionality in the
main framework is silly, IMO.
 
Jon Skeet [C# MVP]wrote:
]PseudoBill said:
There are a number of collections in .NET, such as NameValueCollection
which is pretty close to the VB Collection. However, to play it safe
you can still use the Microsoft.VisualBasic.Collection - it is part
of .NET and if you don't feel like rewriting everything at once, this
is a good option. (but many on this group feel very strongly about
not using anything from the .NET Microsoft.VisualBasic namespace, by
the way).
I certainly feel strongly about not using things from the
Microsoft.VisualBasic namespace just for the sake of avoiding learning

..NET collections. If there are things in the Microsoft.VisualBasic
namespace which don't have any natural .NET equivalent, that's one
thing - but to go out of your way to use what is essentially emulation

of a VB type when there's a type with equivalent functionality in the

main framework is silly, IMO.

--
Jon Skeet - <[email protected]>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me
too[/quote:ec13af79ed]

As an MVP, you should let Microsoft know about this - apparently
Microsoft.VisualBasic is in the .NET framework.
 
PseudoBill said:
As an MVP, you should let Microsoft know about this - apparently
Microsoft.VisualBasic is in the .NET framework.

It's not in the *main* framework. You may have noticed how it's not
documented in MSDN, for instance.

It's also less likely to be present (or complete) with other CLR
implementations such as Mono.
 
Jon Skeet [C# MVP]wrote:
]PseudoBill said:
As an MVP, you should let Microsoft know about this - apparently
Microsoft.VisualBasic is in the .NET framework.
It's not in the *main* framework. You may have noticed how it's not
documented in MSDN, for instance.

It's also less likely to be present (or complete) with other CLR
implementations such as Mono.

--
Jon Skeet - <[email protected]>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me
too[/quote:3243742bd2]

Yeah, I guess...

I'm just too lazy to change all my references to .NET collections in
my "legacy" (converted from vb.net) apps since it's not just a
search/replace procedure.

Sorry for giving you a rough time about this.
 
PseudoBill said:
Jon Skeet [C# MVP]wrote:
I certainly feel strongly about not using things from the
Microsoft.VisualBasic namespace just for the sake of avoiding learning

.NET collections. If there are things in the Microsoft.VisualBasic
namespace which don't have any natural .NET equivalent, that's one
thing - but to go out of your way to use what is essentially emulation

of a VB type when there's a type with equivalent functionality in the

main framework is silly, IMO.

As an MVP, you should let Microsoft know about this - apparently
Microsoft.VisualBasic is in the .NET framework.

Why do you think it exists?

As far as I see, it's not there to be used for new development as such,
but for compatibility with old VB6 code.

Also, please learn to quote properly, or use a client which enables you
to do so.
 
Back
Top