October 12th, 2012, 10:46 AM
Typecasting Object to Struct.
I have a linked list that takes any object, and puts it a struct with some other params:
So when you want to retreive it you create a struct, pass it as a ref, and take the struct.data part.
public VList(Object Data);
passes it to
public struct VData
public double ID;
public Object Data;
public string a;
public string b;
public string c;
public string d;
[ creating instances and stuff]
List.Find(id, ref vdata);
vals = (Vals) vdata.Data;
THis actually worked till I changed some code on the list's library (not really had to do with all these).
Now it sends an InvalidCastException like "Specified cast is not valid."
What's wrong with it?
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.