Reputation: 21416
I have the following method in my C# class.
For the parameter called 'collections' I would like to have the flexibility of either passing a List or string[ ] array. I know I could simply set the parameter type as object type, but is there any other more efficient type I could use to do this?
public string ProcessDoc(List<string> collections, string userName)
{
//code goes here
string result = null;
...
...
return result;
}
Upvotes: 0
Views: 1702
Reputation: 460340
You could use IList<string>
:
public string ProcessDoc(IList<string> collections, string userName)
{
//code goes here
string result = null;
...
...
return result;
}
Upvotes: 7