What is string.ToUpper() in C#?

The ToUpper() function converts a string to uppercase.

The following figure shows a visual representation of the ToUpper() function.

Figure 1: Visual representation of ToUpper() function

Syntax

string_name.ToUpper()

string_name is the name of the string which is to be converted to uppercase

Parameter

The ToUpper() function does not require a parameter.

Return value

The ToUpper() function returns a string that is converted to uppercase.

Code

class String
{
static void Main()
{
//string
System.Console.WriteLine("('educative').ToUpper(): "+ ("educative").ToUpper());
//string with number
System.Console.WriteLine("('educative09').ToUpper(): "+ ("educative09").ToUpper());
}
}