2.0 WebService and string split

M

MarkusJNZ

Hi, I have a very simple webmethod which returns a string.

When I try to consume the webservice and split into an array I receive
an error

"cannot apply indexing with [] to an expression of type 'method group'"

my code for consuming the webservice is below

RandomString _randString = new RandomString();
string[] stringArray = _randString.GetRandomString().Split['|'];

Where RandomString is the webreference in my VS2005 project
and GetRandomString() is the web method I am calling

Any ideas?
thanks
Markus
 
G

Guest

Howdy,

_randString.GetRandomString().Split('|');
or
_randString.GetRandomString().Split(new char[] {'|'});
 
M

MarkusJNZ

Thanks, that worked fine
Regards
Markus
Milosz said:
Howdy,

_randString.GetRandomString().Split('|');
or
_randString.GetRandomString().Split(new char[] {'|'});
--
Milosz Skalecki
MCAD


Hi, I have a very simple webmethod which returns a string.

When I try to consume the webservice and split into an array I receive
an error

"cannot apply indexing with [] to an expression of type 'method group'"

my code for consuming the webservice is below

RandomString _randString = new RandomString();
string[] stringArray = _randString.GetRandomString().Split['|'];

Where RandomString is the webreference in my VS2005 project
and GetRandomString() is the web method I am calling

Any ideas?
thanks
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top