I have a class constructor that takes a IList<IElement>
as an argument.
When creating a new instance of the class I'm able to pass a IElement[]
instead of the IList<IElement>
how is that posible?
I have a class constructor that takes a IList<IElement>
as an argument.
When creating a new instance of the class I'm able to pass a IElement[]
instead of the IList<IElement>
how is that posible?
An array with element type T
derives from IList<T>
.
This is not visible in the meta-data in mscorlib.dll, but the inheritance relationship is created at runtime in the CLR. C# and the CLR are aware of the array type and treat it specially.