Got a bit of a mind freeze at the moment. I have the following syntax:-
string[] repname = Thread.CurrentPrincipal.Identity.ToString().Split('\');
and I get an error on the split character. Can anyone advise on how I can do the split using the \ character as the delimiter?
Cheers
Use
Split('\\')
"\" is an escape character.
Split takes a char[] as a parameter, not a char. Try;
string[] repname = Thread.CurrentPrincipal.Identity.ToString().Split(new char[] {'\\'});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With