CultureAndRegionInfoBuilder.Unregister Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Deletes a custom culture from the local computer.

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

public static void Unregister(
	string cultureName


Type: System.String

The name of the custom culture to delete.

Exception Condition

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


The user does not have administrative privileges.


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.


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.

   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() 
        Console.WriteLine("Unregister the \"x-en-US-sample\" " +
                          "custom culture if it already exists...");
        Console.WriteLine("The custom culture was unregistered successfully.");
    catch (Exception e)
        Console.WriteLine("Error while unregistering...");
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
Available since 2.0
Return to top