I have PInfo2[] pInfo
and need to use it as an IEnumerable<PInfo3> betterInfo
where public class PInfo3 : PInfo2
What I've tried, but doesn't work:
(IEnumerable<PInfo3>)pInfo //Runtime error: "Unable to cast object of type 'PInfo2[]' to type 'System.Collections.Generic.IEnumerable`1[
IEnumerable<PInfo3> betterInfo = pInfo as IEnumerable<PInfo3>; //Always null after cast.
What am I doing wrong, aka how am I being dumb? Do I need to for-loop through the array? I don't know why but I was hoping I didn't have to do that.