Function Parameters...
-
How to define optional parameter in C# fuction or can define single optional parameter???? please help me Thanks in Advance..
-
How to define optional parameter in C# fuction or can define single optional parameter???? please help me Thanks in Advance..
-
How to define optional parameter in C# fuction or can define single optional parameter???? please help me Thanks in Advance..
Do you mean how can you add a variable number of parameters?
public void DoSomething(params object[] parameters) { foreach (object parameter in parameters) { ... } }
Deja View - the feeling that you've seen this post before.
-
How to define optional parameter in C# fuction or can define single optional parameter???? please help me Thanks in Advance..
Create an overload. As long as the function signatures differ in the parameter list (or return type, but not advisable), you can have two functions with the same name. You end up with something like this:
function Add(object item)
{
...
}function Add(object item, string name)
{
...
}----------------------------- In just two days, tomorrow will be yesterday.