I have a webservice that returns me an object with data
object data = _wsUsuario.CarregarDadosUsuario(_view.Usuario);
This object, called data, returns me the following:
[0] 84
[1] Marcelo Camargo
[2] [email protected]
[3] 2
If I try to do
MessageBox.Show(data[0]);
Then the compiler says me:
Cannot apply indexing to an expression of type 'object'. I searched and wonder if there is a way to convert this object of strings and integers to an array. Can you give me a hand?
MessageBox.Show(((string[])data)[0]);CarregarDadosUsuarioactually typed return - that is, what is the method signature? (I would hope it was an Array/IEnumerable/custom of some sort.) If it isn'tobject, you might be doing this The Hard Way by slopping it into such a variable. If it is unfortunately typed to return an object, what is the type of the actual object that is returned?