CultureAndRegionInfoBuilder.Unregister(String) メソッド

定義

ローカル コンピューターからカスタム カルチャを削除します。

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)

パラメーター

cultureName
String

削除するカスタム カルチャの名前。

例外

cultureName は、依存カルチャの親カルチャまたはコンソール フォールバック ユーザー インターフェイス カルチャです。

ユーザーに管理特権がありません。

cultureName に指定されているカルチャが見つかりません。

Unregisterメソッドの例を次に示します。

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

注釈

メソッドは Unregister 、 メソッドの逆を Register 行います。 メソッドは Register 、Windows API GetWindowsDirectory 関数によって返されるディレクトリのグローバリゼーション サブディレクトリに、ローカル コンピューター上のファイルとしてカスタム カルチャを格納します。 メソッドは Unregister 、永続化されたカスタム カルチャ ファイルをコンピューターから削除します。 ファイルが削除された後も、コンピューター メモリ内のカスタム カルチャの既存のインスタンスは引き続き機能しますが、カスタム カルチャの新しいインスタンスを作成することはできません。

適用対象

こちらもご覧ください