Skip to main content
Home Forums Silverlight Programming Programming with .NET - General List<T> cast error
2 replies. Latest Post by xxdevxx on April 29, 2009.
(0)
xxdevxx
Member
9 points
67 Posts
04-29-2009 10:58 AM |
I have a new webservice that returns a List where T is a own defined class. When it comes back to Silverlight I can see (in debug) that e.result have all the values. But how do I cast it back to a List ?? List allCars = new List(); allCars = e.Result as List; Error: Cannot convert type 'SilverlightApplication1.myWebService.ArrayOfmyCar' to 'System.Collections.Generic.List' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\SPSearchSL2\SilverlightApplication1\Page.xaml.cs 64 23 SilverlightApplication1
Tony.Cha...
634 points
91 Posts
04-29-2009 11:12 AM |
You were close.
e.Result.ToList();
This should get you up and running. Let me know if this doesn't work.
Tony Champion
04-29-2009 11:22 AM |
Ahh, thanks Tony!