Monday, October 20, 2008

Access methods after converting to another type - C#

So this below was not working because the compiler could not find the ToLower() method....

object myvalue;
// do other stuff here
myvalue = (string) value.ToLower();


But wrapping it up a little more exposes those methods.....

((string) value).ToLower();

No comments: