Bagikan melalui


CultureAndRegionInfoBuilder.Unregister(String) Metode

Definisi

Menghapus budaya kustom dari komputer lokal.

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)

Parameter

cultureName
String

Nama budaya kustom yang akan dihapus.

Pengecualian

cultureName adalah budaya induk atau budaya antarmuka pengguna fallback konsol dari budaya dependen.

Pengguna tidak memiliki hak administratif.

cultureName menentukan budaya yang tidak ditemukan.

Contoh

Contoh berikut menunjukkan Unregister metode .

// 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.
'

Keterangan

Metode Unregister melakukan kebalikan dari Register metode . Metode ini Register menyimpan budaya kustom sebagai file di komputer lokal, di subdirektori Globalisasi direktori yang dikembalikan oleh fungsi Windows API GetWindowsDirectory . Metode menghapus Unregister file budaya kustom yang bertahan dari komputer. Setelah file dihapus, instans budaya kustom yang ada dalam memori komputer terus berfungsi, tetapi instans baru dari budaya kustom tidak dapat dibuat.

Berlaku untuk

Lihat juga