예제 #1
0
        public static IDisposable Invariant()
        {
            var currentCulture = System.Globalization.CultureInfo.CurrentCulture;

            System.Globalization.CultureInfo.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            return(DisposableLock.Lock(() => {
                System.Globalization.CultureInfo.CurrentCulture = currentCulture;
            }));
        }
예제 #2
0
        public static IDisposable Measure(Action <TimeSpan> result)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            return(DisposableLock.Lock(() => {
                sw.Stop();
                result(sw.Elapsed);
            }));
        }