Usually my methods are as the following:
public List<int> Method1(int input)
{
var output = new List<int>();
//add some items to output
return output;
}
But FxCop advises another IList implementation instead of List, but I can't remember which. The alternatives include returning it as an IList, ICollection or IEnumerable for more flexibility or a whole different way as the code below.:
public int[] Method2(int input)
{
var output = new List<int>();
//add some items to output
return output.ToArray();
}
Of all alternatives, all provided and all possibilities, which is considered the best practice?