Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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"
hasil[0].GetValue(0)
Array[]
int[]
int[][]
GetValue method returns object type so you have to explicitly convert it to int
GetValue
object
int
Like this
int xx = (int)hasil[0].GetValue(0);
Add a comment
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.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
Array[]filled withint[]instead of using directly anint[][]?int[]and n params