2.0 WebService and string split

  • Thread starter Thread starter MarkusJNZ
  • Start date Start date
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
 
Howdy,

_randString.GetRandomString().Split('|');
or
_randString.GetRandomString().Split(new char[] {'|'});
 
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
 
Back
Top