Re: converting List into IEnumerable

2010-08-12 Thread silky
On Thu, Aug 12, 2010 at 9:58 PM, Wallace Turner wrote: > Thanks for the clarification. > > > The danger with co-variance of arrays is that you can cast an array of > > string to an array of object and then proceed to assign any type of object > > (say an int or a `Foo`) to the array resulting in a

RE: converting List into IEnumerable

2010-08-12 Thread Wallace Turner
it more an issue of simply using an object[ ] array per se. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of James Chapman-Smith Sent: Thursday, 12 August 2010 9:23 PM To: 'ozDotNet' Subject: RE: converting List into IEnumerable Hi Wal, Wit

RE: converting List into IEnumerable

2010-08-12 Thread James Chapman-Smith
James. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Wallace Turner Sent: Thursday, 12 August 2010 18:01 To: 'ozDotNet' Subject: converting List into IEnumerable Hi, Assume the class definitions interface IOrder { } class Order : IOrder { }

RE: converting List into IEnumerable

2010-08-12 Thread Wallace Turner
3.5 SP1. Just copied it over to VS2010 (why haven't i upgraded yet!?) and it worked like you said. From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On Behalf Of Michael Minutillo Sent: Thursday, 12 August 2010 6:50 PM To: ozDotNet Subject: Re: converting List

Re: converting List into IEnumerable

2010-08-12 Thread Michael Minutillo
Hi Wal, What version of the framework are you using. In .NET 4, both work fine. Regards, Michael M. Minutillo Indiscriminate Information Sponge Blog: http://wolfbyte-net.blogspot.com On Thu, Aug 12, 2010 at 4:31 PM, Wallace Turner wrote: > Hi, > > Assume the class definitions > > interface

converting List into IEnumerable

2010-08-12 Thread Wallace Turner
Hi, Assume the class definitions interface IOrder { } class Order : IOrder { } I understand why this doesn't compile: var list = new List(); IEnumerable iOrders = list; //IEnumerable not same type as List! So using that logic, can't understand why this *does* compile: var arr =