Exemplo n.º 1
0
 internal static void RunWithPreservedCulture <T>(CulturePair preservedCulture, Action <T> action, T arg)
 {
     RunWithPreservedCulture(preservedCulture, (f, state) => {
         f(state);
         return((object)null);
     },
                             action, arg);
 }
Exemplo n.º 2
0
        internal static TResult RunWithPreservedCulture <T1, T2, TResult>(CulturePair preservedCulture, Func <T1, T2, TResult> func, T1 arg1, T2 arg2)
        {
            var replacedCulture = SaveCulture();

            try {
                Thread.CurrentThread.CurrentCulture   = preservedCulture.Culture;
                Thread.CurrentThread.CurrentUICulture = preservedCulture.UICulture;
                return(func(arg1, arg2));
            } finally {
                Thread.CurrentThread.CurrentCulture   = replacedCulture.Culture;
                Thread.CurrentThread.CurrentUICulture = replacedCulture.UICulture;
            }
        }
Exemplo n.º 3
0
 internal static void RunWithPreservedCulture(CulturePair preservedCulture, Action action)
 {
     RunWithPreservedCulture(preservedCulture, f => f(), action);
 }
Exemplo n.º 4
0
 internal static TResult RunWithPreservedCulture <T, TResult>(CulturePair preservedCulture, Func <T, TResult> func, T arg)
 {
     return(RunWithPreservedCulture(preservedCulture, (f, state) => f(state), func, arg));
 }