I have used a string in C# where i am using C# in Visual studio 2008. I wanted to convert it to uppercase.
string lowerString = txtCheck.Text;
string upperString = lowerString.ToUpper();
Normally this is how i should have used, But the thing is i didn’t get any error when i used it like this
string upperString = lowerString.ToUpper().Tostring();
Now i am confused that ToUpper() is also a function, then how can i use the second syntax where i again use ToUpper().Tostring(); . I mean It would mean Function1().Function2().
No, you’re calling
ToStringon the object returned byToUpper. This is pointless, but it’s not a compilation error. If you did:that will indeed give you an error, since you can’t call a method (ToString) on a method group.