String::ToUpperInvariant Method

Returns a copy of this String object converted to uppercase using the casing rules of the invariant culture.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public:
String^ ToUpperInvariant()

Return Value

Type: System::String
The uppercase equivalent of the current string.

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. For more information, see the CultureInfo::InvariantCulture property.

If your application depends on the case of a string changing in a predictable way that is unaffected by the current culture, use the ToUpperInvariant method. The ToUpperInvariant method is equivalent to ToUpper(CultureInfo.InvariantCulture). The method is recommended when a collection of strings must appear in a predictable order in a user interface control.

NoteNote

This 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.

Security Considerations

If you need the lowercase or uppercase version of an operating system identifier, such as a file name, named pipe, or registry key, use the ToLowerInvariant or ToUpperInvariant methods.

The following example defines a string array that contains a single word in a number of languages. The ToUpperInvariant method is used to populate the elements of a parallel array with the case-insensitive version of each word. The Array::Sort<TKey, TValue>(array<TKey>, array<TValue>, IComparer<TKey>) method is used to sort the case-sensitive array based on the order of elements in the uppercase array to ensure that elements appear in the same order regardless of language.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft