Class CultureSettingHelper
Context class that will remember the current culture settings, and reset them when it is disposed.
Implements
Inherited Members
Namespace: SuperOffice.Globalization
Assembly: SoCore.dll
Syntax
public sealed class CultureSettingHelper : IDisposable
Examples
This class is meant for a using() clause, when you temporarily need to set the current culture to something else than the default, and want to go back afterwards.
// in this example, the culture name is known
using( new CultureSettingHelper( myCultureName )) // set both current and currentUI cultures on current thread
{
// culture-dependent processing
}
// culture has been restored
Constructors
CultureSettingHelper()
Save the current culture settings, and do not change them
Declaration
public CultureSettingHelper()
CultureSettingHelper(CultureInfo)
Save the current culture settings, and set both the CurrentCulture and CurrentUICulture on the current thread to the new value.
Declaration
public CultureSettingHelper(CultureInfo newCurrentCulture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | newCurrentCulture | Culture to set (both current and currentUI) |
CultureSettingHelper(CultureInfo, CultureInfo)
Save the current culture settings, and set both the CurrentCulture and CurrentUICulture on the current thread to the new values.
Declaration
public CultureSettingHelper(CultureInfo newCurrentCulture, CultureInfo newCurrentUICulture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | newCurrentCulture | Culture to set |
CultureInfo | newCurrentUICulture | UI Culture to set |
CultureSettingHelper(string)
Save the current culture settings, and set both the CurrentCulture and CurrentUICulture on the current thread to the new value.
Declaration
public CultureSettingHelper(string newCultureName)
Parameters
Type | Name | Description |
---|---|---|
string | newCultureName |
CultureSettingHelper(string, string)
Save the current culture settings, and set both the CurrentCulture and CurrentUICulture on the current thread to the new values.
Declaration
public CultureSettingHelper(string newCultureName, string newUICultureName)
Parameters
Type | Name | Description |
---|---|---|
string | newCultureName | |
string | newUICultureName |
Methods
Dispose()
Reset the culture to the saved settings
Declaration
public void Dispose()