Unable to cast object of type 'Data' to type 'System.IConvertible'

KnjazkovaoIb

New Member
Im getting this error "Unable to cast object of type 'Data' to type 'System.IConvertible'."in my code\[code\]foreach (Data p in clusters) { for(int z=0; z<53;z++) { if (values[z] = Convert.ToInt32(p)) { lray[z].BackColor = colorSet; } } }\[/code\]"values" is an integer array and p is from Data class\[code\]class Data { public int X, ClusterId; public Data(int x) { this.X = x; } public override string ToString() { return String.Format("({0})", X); } public static int DistanceSquared(Data p1, Data p2) { int diffX = p2.X - p1.X; return diffX * diffX; } }\[/code\]
 
Back
Top