I would like to perform a cast of something like this:
// Entity Data and Entity A_Data has exactly the same properties: sName and sZip.
List<Data> ListData = new List<Data>();
List<A_Data> ListA_Data = (A_Data)ListData.FindAll(item => item.sName.StartsWith("A"));
VS2010 keeps telling me that I cannot make this cast. Any help would be appreciated.
Unless a class is explicitly declared to derive from another cast, you cannot cast between them. Even if they have the same properties or fields.
You need a converter method in this case:
Not sure if there’s anything in EF4 that helps with this.