Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- static class Program
- {
- static void Main()
- {
- // all three print the same time
- Field.FieldA.DoSomething();
- for (int i = 0; i < 1000; i++) /*waste time */ ;
- Field.FieldA.FieldA.DoSomething();
- for (int i = 0; i < 1000; i++) /*waste time */ ;
- Field.FieldA.FieldA.FieldA.DoSomething();
- Console.ReadKey();
- }
- class Field
- {
- public class FieldA : Field
- {
- private static DateTime _time;
- static FieldA() { _time = DateTime.Now; }
- public static void DoSomething() { Console.WriteLine(_time.ToLongTimeString()); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement