B BillG Oct 2, 2007 #1 I have a List collection object that I need to assign to a property that is expecting a IEnumerable. How do I do that? Thanks Bill
I have a List collection object that I need to assign to a property that is expecting a IEnumerable. How do I do that? Thanks Bill
N Nicholas Paldino [.NET/C# MVP] Oct 2, 2007 #2 Bill, The List<T> class implements the IEnumerable interface, so you should have no problem assigning it to a property that expects it. Are you getting an exception/compile error? If so, what is it?
Bill, The List<T> class implements the IEnumerable interface, so you should have no problem assigning it to a property that expects it. Are you getting an exception/compile error? If so, what is it?
A Alex Meleta Oct 2, 2007 #3 Hi BillG, Then just assign it: IEnumerable value = new List<int>(); as well as to IList<T>, ICollection<T>, IEnumerable<T>, IList and ICollection Regards, Alex [TechBlog] http://devkids.blogspot.com B> I have a List collection object that I need to assign to a property B> that is expecting a IEnumerable. How do I do that? B> B> Thanks B> Bill
Hi BillG, Then just assign it: IEnumerable value = new List<int>(); as well as to IList<T>, ICollection<T>, IEnumerable<T>, IList and ICollection Regards, Alex [TechBlog] http://devkids.blogspot.com B> I have a List collection object that I need to assign to a property B> that is expecting a IEnumerable. How do I do that? B> B> Thanks B> Bill