ToLowerInvariant Método
TOC
Collapse the table of content
Expand the table of content
Este artículo se tradujo automáticamente. Para ver el artículo en inglés, active la casilla Inglés. Además, puede mostrar el texto en inglés en una ventana emergente si mueve el puntero del mouse sobre el texto.
Traducción
Inglés

String.ToLowerInvariant (Método) ()

 

Devuelve una copia de este objeto String convertido en minúsculas, aplicando las reglas de mayúsculas y minúsculas de la referencia cultural de todos los idiomas.

Espacio de nombres:   System
Ensamblado:  mscorlib (en mscorlib.dll)

public string ToLowerInvariant()

Valor devuelto

Type: System.String

Equivalente en minúsculas de la cadena actual.

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 P:System.Globalization.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 M:System.String.ToLowerInvariant method. The M:System.String.ToLowerInvariant method is equivalent to ToLower(CultureInfo.InvariantCulture). The method is recommended when a collection of strings must appear in a predictable order in a user interface control.

System_CAPS_noteNota

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

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 M:System.String.ToLowerInvariant or M:System.String.ToUpperInvariant methods.

The following example defines a string array that contains a single word in a number of languages. The M:System.String.ToLowerInvariant method is used to populate the elements of a parallel array with the case-insensitive version of each word. The M:System.Array.Sort``2(``0[],``1[],System.Collections.Generic.IComparer{``0}) method is used to sort the case-sensitive array based on the order of elements in the lowercase array to ensure that elements appear in the same order regardless of language.

using System;

public class Example
{
   public static void Main()
   {
      string[] words = { "Tuesday", "Salı", "Вторник", "Mardi", 
                         "Τρίτη", "Martes", "יום שלישי", 
                         "الثلاثاء", "วันอังคาร" };
      // Display array in unsorted order.
      foreach (string word in words)
         Console.WriteLine(word);
      Console.WriteLine();

      // Create parallel array of words by calling ToLowerInvariant.
      string[] lowerWords = new string[words.Length];
      for (int ctr = words.GetLowerBound(0); ctr <= words.GetUpperBound(0); ctr++)
         lowerWords[ctr] = words[ctr].ToLowerInvariant();

      // Sort the words array based on the order of lowerWords.
      Array.Sort(lowerWords, words, StringComparer.InvariantCulture);

      // Display the sorted array.
      foreach (string word in words)
         Console.WriteLine(word);
   }
}
// The example displays the following output:
//       Tuesday
//       Salı
//       Вторник
//       Mardi
//       Τρίτη
//       Martes
//       יום שלישי
//       الثلاثاء
//       วันอังคาร
//       
//       Mardi
//       Martes
//       Salı
//       Tuesday
//       Τρίτη
//       Вторник
//       יום שלישי
//       الثلاثاء
//       วันอังคาร

Universal Windows Platform
Disponible desde 4.5
.NET Framework
Disponible desde 2.0
Portable Class Library
Compatible con: portable .NET platforms
Silverlight
Disponible desde 4.0
Windows Phone Silverlight
Disponible desde 7.0
Windows Phone
Disponible desde 8.1
Volver al principio
Mostrar:
© 2016 Microsoft