Conversion problem

  • Thread starter Thread starter BillG
  • Start date Start date
B

BillG

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
 
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top