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 сохраняет пользовательский язык и региональные параметры в виде файла на локальном компьютере в подкаталоге Globalization каталога, возвращаемого функцией GetWindowsDirectory API Windows. Метод Unregister удаляет сохраненный пользовательский файл языка и региональных параметров с компьютера. После удаления файла существующие экземпляры пользовательского языка и региональных параметров в памяти компьютера продолжают работать, но новые экземпляры пользовательского языка и региональных параметров невозможно создать.