In my method I tried to manipulate a string parameter using IndexOf()
method -- even though it compiles all the string methods (IndexOf,
Trim, UpperCase....) fail -- except the property Length. The strange
thing is neither compiler or run-time system generates any error:
static string ServerUrl(string server, string port, string resource)
{
// server.Length would return the correct length of string... but...
int x = server.IndexOf("/");
// x is "out of scope" when putting breakpoint here...
if(x == -1)
{
return string.Format("http://{0}:{1}/{2}", server, port, resource);
}
// execution continues without any error...
string[] parts = server.Split('/');
return string.Format("http://{0}:{1}/{2}/{3}", parts[0], port,
parts[1], resource);
}
Any ideas?