Export (0) Print
Expand All

CultureAndRegionInfoBuilder.Unregister Method

Deletes a custom culture from the local computer.

Namespace:  System.Globalization
Assembly:  sysglobl (in sysglobl.dll)

public static void Unregister(
	string cultureName
)

Parameters

cultureName
Type: System.String

The name of the custom culture to delete.

ExceptionCondition
InvalidOperationException

cultureName is a parent culture or console fallback user interface culture of a dependent culture.

UnauthorizedAccessException

The user does not have administrative privileges.

ArgumentException

cultureName specifies a culture that is not found.

The Unregister method does the reverse of the Register method. The Register method stores a custom culture as a file on the local computer, in the Globalization subdirectory of the directory returned by the Win32 API GetWindowsDirectory function. The Unregister method deletes the persisted custom culture file from the computer. After the file is deleted, existing instances of the custom culture in computer memory continue to work, but new instances of the custom culture cannot be created.

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition Platform Note: A custom culture cannot be unregistered if it is in use.

The following example demonstrates the Unregister method.

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

*/

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

Show:
© 2014 Microsoft