I have one function having two fixed arguments. But next arguments are not fixed, there can be two or three or four of them.
It’s a runtime arguments so how can I define that function?
My code looks like:
public ObservableCollection<ERCErrors> ErrorCollectionWithValue
(string ErrorDode, int MulCopyNo, dynamic arguments comming it should be 2 or 3)
{
return null;
}
1) params (C# Reference)
2) Named and Optional Arguments (C# Programming Guide)
3) And maybe simple method overloading would still suit better, separating method logic to different methods? Under this link you can also find another description of named and optional parameters