Last active
March 13, 2019 17:29
-
-
Save felipeslongo/f10e42f25ea3ca1d949e002cda5e3ec9 to your computer and use it in GitHub Desktop.
Set CultureInfo for the entire application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Threading; | |
| namespace System.Globalization | |
| { | |
| public static class CultureInfo_Setters | |
| { | |
| public static void SetForApplication(this CultureInfo @this) | |
| { | |
| @this.SetForCurrentThread(); | |
| @this.SetForThreadPoolThreads(); | |
| } | |
| public static void SetForCurrentThread(this CultureInfo @this) | |
| { | |
| Thread.CurrentThread.CurrentCulture = @this; | |
| Thread.CurrentThread.CurrentUICulture = @this; | |
| } | |
| public static void SetForThreadPoolThreads(this CultureInfo @this) | |
| { | |
| CultureInfo.DefaultThreadCurrentCulture = @this; | |
| CultureInfo.DefaultThreadCurrentUICulture = @this; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment