Reputation: 41
example :
Array[] hasil = new Array[1];
hasil[0] = new int[1];
hasil[0].SetValue(99, 0);
int xx = hasil[0].GetValue(0);
why I can't get hasil[0].GetValue(0)
it say "cannot implicitly convert type object to int"
Upvotes: 0
Views: 1302
Reputation: 8980
GetValue
method returns object
type so you have to explicitly convert it to int
Like this
int xx = (int)hasil[0].GetValue(0);
Upvotes: 2
Reputation: 1561
Cast your value:
(int)hasil[0].GetValue(0);
When your compilator says it can't implicitly cast, you have to do it explicitly. Then add a cast.
Upvotes: 0