I am trying to pass a List to a constructer which takes List.
Constructor
public Constructor (List<IData> data) { ... }
Calling Constructor
var a = new Constructor (new List<source> ()); This is failed
source is subclass of IData where IData is an interface.
If I passing it like that, I will get the exception.
But if I cast it like this : var a = (new List<string>()).Cast<object>()
,
it become messy. Later, if I want to use string functions, I will need to cast the object back to string before I can call the string function.