C# – Convert String to Uppercase

To convert String to uppercase in C#, call String.ToUpper() method on the String instance. ToUpper() returns a transformed string of our original string, where lowercase characters are converted to uppercase characters.

Reference to C# String.ToUpper() method.

Example

In the following program, we will take a string "Hello World" and convert the string to uppercase using ToUpper() method.

C# Program

</>
Copy
using System;
  
class Example {
    static void Main(string[] args) {
        String str = "Hello World";
        String result = str.ToUpper();
        Console.WriteLine($"Original String  : {str}");
        Console.WriteLine($"Uppercase String : {result}");
    }
}

Output

Original String  : Hello World
Uppercase String : HELLO WORLD

Conclusion

In this C# Tutorial, we have learned how to convert a given string into uppercase using String.ToUpper() method.