Char.ToUpperInvariant(Char) Method in C#


The Char.ToUpperInvariant() method in C# is used to convert the value of a Unicode character to its uppercase equivalent using the casing rules of the invariant culture.

Syntax

public static char ToUpperInvariant (char ch);

Above, the parameter ch is the Unicode character to convert.

Let us now see an example to implement the Char.ToUpperInvariant() method −

Example

using System;
public class Demo {
   public static void Main(){
      char ch = 'q';
      char res = Char.ToUpperInvariant(ch);
      Console.WriteLine("Value = "+ch);
      Console.WriteLine("Uppercase Equivalent = "+res);
   }
}

Output

This will produce the following output −

Value = q
Uppercase Equivalent = Q

Let us now see another example −

Example

using System;
public class Demo {
   public static void Main(){
      char ch = 'r';
      char res = Char.ToUpperInvariant(ch);
      Console.WriteLine("Value = "+ch);
      Console.WriteLine("Uppercase Equivalent = "+res);
   }
}

Output

This will produce the following output −

Value = r
Uppercase Equivalent = R

Updated on: 04-Nov-2019

120 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements