I have been told that there is no such thing as optional parameters in C#. But you can use overload functionality and input varibles with default values such as:
void Person(string name, int age)
void Person(string name)
and
void Person(string name, int age = 30)
My problem is that when calling C# components from VB6 overloaded methods tends to change name to for example "Person(string name), Person_1(string name, int age)" etc, and variables with default values can't be used when beeing "out" variables.
BUT how about
void Person(string name, [Optional] int age)
??
Can someone explain to me how that work and if i can use it to simulate optional variables in VB6?
C# 4.0 does indeed have optional parameters: