CultureAndRegionInfoBuilder.Unregister(String) Metodo

Definizione

Elimina impostazioni cultura personalizzate dal computer locale.

public:
 static void Unregister(System::String ^ cultureName);
public static void Unregister (string cultureName);
static member Unregister : string -> unit
Public Shared Sub Unregister (cultureName As String)

Parametri

cultureName
String

Nome delle impostazioni cultura personalizzate da eliminare.

Eccezioni

cultureName rappresenta le impostazioni cultura padre o le impostazioni cultura di fallback dell'interfaccia utente della console di impostazioni cultura dipendenti.

L'utente non dispone dei privilegi di amministratore.

cultureName specifica impostazioni cultura non trovate.

Esempio

Nell'esempio seguente viene illustrato il Unregister metodo.

// This example demonstrates the System.Globalization.Culture-
// AndRegionInfoBuilder Unregister method.
// Compile this example with a reference to sysglobl.dll.

/*
   Notes:
   This example deletes the custom culture x-en-US-sample.nlp
   file, but not the %winnt%\Globalization directory that contains the file.
*/

using System;
using System.Globalization;

class Sample
{
    public static void Main()
    {
    try
        {
        Console.Clear();
        Console.WriteLine("Unregister the \"x-en-US-sample\" " +
                          "custom culture if it already exists...");
        CultureAndRegionInfoBuilder.Unregister("x-en-US-sample");
        Console.WriteLine("The custom culture was unregistered successfully.");
        }
    catch (Exception e)
        {
        Console.WriteLine("Error while unregistering...");
        Console.WriteLine(e);
        }
    }
}
/*
This code example produces the following results:

Unregister the "x-en-US-sample" custom culture if it already exists...
The custom culture was unregistered successfully.

*/
' This example demonstrates the System.Globalization.Culture-
' AndRegionInfoBuilder Unregister method.
' Compile this example with a reference to sysglobl.dll.
'
'   Notes:
'   This example deletes the custom culture x-en-US-sample.nlp 
'   file, but not the %winnt%\Globalization directory that contains the file.
'

Imports System.Globalization

Class Sample
    Public Shared Sub Main() 
        Try
            Console.Clear()
            Console.WriteLine("Unregister the ""x-en-US-sample"" " & _
                               "custom culture if it already exists...")
            CultureAndRegionInfoBuilder.Unregister("x-en-US-sample")
            Console.WriteLine("The custom culture was unregistered successfully.")
        Catch e As Exception
            Console.WriteLine("Error while unregistering...")
            Console.WriteLine(e)
        End Try
    
    End Sub
End Class
'
'This code example produces the following results:
'
'Unregister the "x-en-US-sample" custom culture if it already exists...
'The custom culture was unregistered successfully.
'

Commenti

Il Unregister metodo esegue l'operazione inversa del Register metodo . Il Register metodo archivia impostazioni cultura personalizzate come file nel computer locale, nella sottodirectory Globalization della directory restituita dalla funzione GetWindowsDirectory dell'API Windows. Il Unregister metodo elimina il file delle impostazioni cultura personalizzate persistente dal computer. Dopo l'eliminazione del file, le istanze esistenti delle impostazioni cultura personalizzate nella memoria del computer continuano a funzionare, ma non è possibile creare nuove istanze delle impostazioni cultura personalizzate.

Si applica a

Vedi anche