String.ToUpperInvariant Method is used to get a copy of this String object converted to uppercase using the casing rules of the invariant culture. Here “invariant culture” represents a culture that is culture-insensitive.
public string ToUpperInvariant ();
Return Value: The return type of this method is System.String. This method will return a string which is the uppercase equivalent of the current string.
Below given are some examples to understand the implementation in a better way:
String before ToUpperInvariant: WelCome tO GeeKSfOrGeeKs String after ToUpperInvariant: WELCOME TO GEEKSFORGEEKS
string 1: GEeks string 2: GEEKS string 1: geeks string 2: GEEKS string 1: GEEKS string 2: GEEKS
- The invariant culture represents a culture that is culture-insensitive. It is associated with the English language but not with a specific country or region.
- ToUpperInvariant() method does not modify the value of the current instance. Instead, it returns a new string in which all characters in the current instance are converted to uppercase.
- This method can’t be overloaded if you try to overload this method, it will give you compile time error.
- Difference between Method Overriding and Method Hiding in C#
- C# | Join Method | Set - 2
- C# | Uri.IsBaseOf(Uri) Method
- Stack.Contains() Method in C#
- C# | Math.Pow() Method
- C# | Uri.GetHashCode() Method
- C# | ToCharArray() Method
- C# | IsNullOrWhiteSpace() Method
- C# | Dictionary.Add() Method
- C# | Uri.FromHex() Method
- C# | Uri.IsHexDigit() Method
- Stack.Pop() Method in C#
- C# | IsNullOrEmpty() Method
- Decimal.Add() Method in C#
- C# | Clone() Method
- C# | Method Parameters
- C# | Method Overloading
- DateTimeOffset.Add() Method in C#
- C# | Uri.IsWellFormedOriginalString() Method
- Extension Method in C#
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.