M
Mad Scientist Jr
I have been doing this kind of thing in VB and VB.net for a long time,
but am having problems in C#:
First I want to split up a string by the backslash character, but this
line:
arrSplit = strTemp.Split( (@"\") );
results in the error:
The best overloaded method match for 'string.Split(params char[])'
has some invalid arguments
So I tried this instead:
arrSplit = strTemp.Split( (@"\").ToCharArray() );
which does not error. However a few lines down, there is now a new
error:
for (iLoop = arrSplit.GetLowerBound( 0 ); iLoop <=
arrSplit.GetUpperBound( 0 ); iLoop++)
{
strTemp = arrSplit[iLoop].ToString.ToUpper;
The above line gives the error:
Cannot apply indexing with [] to an expression of type 'System.Array'
Can anyone tell me what I'm doing wrong and how to split the string &
loop through the parts?
Thanks
but am having problems in C#:
First I want to split up a string by the backslash character, but this
line:
arrSplit = strTemp.Split( (@"\") );
results in the error:
The best overloaded method match for 'string.Split(params char[])'
has some invalid arguments
So I tried this instead:
arrSplit = strTemp.Split( (@"\").ToCharArray() );
which does not error. However a few lines down, there is now a new
error:
for (iLoop = arrSplit.GetLowerBound( 0 ); iLoop <=
arrSplit.GetUpperBound( 0 ); iLoop++)
{
strTemp = arrSplit[iLoop].ToString.ToUpper;
The above line gives the error:
Cannot apply indexing with [] to an expression of type 'System.Array'
Can anyone tell me what I'm doing wrong and how to split the string &
loop through the parts?
Thanks