c# - Why can't new[] {AnonymousType, AnonymousType} be casted to IEnumerable? -
I have an anonymous type array that has been declared as:
Var list = new [] {New {name = "a", age = 10}, new {name = "b", age = 15}}
Is received, which implements IEnumerable fails the following:
convert. Type the exchange (list, typef (IEnumerable);
Also fails:
convert.changeTip (list, type (array));
Kind regards,
convert Change type requires implementation of
IConvertible
- Announcement to convert from source type to target type originally. The System.Array
IConvertible does not implement the
interface.
What you are trying to do is from one type to another, and (
edit:
As John It says that the artist here is contained, so an ordinary income (i.e. the underlying artist) also works as an IEnumerable.
Comments
Post a Comment