public static void Main() { System.Collections.Generic.Stack<int> stack = new System.Collections.Generic.Stack<int>(); System.Collections.Generic.Stack<int>.Enumerator enumerator; IDisposable disposable; enumerator = stack.GetEnumerator(); try { int number; while(enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } } finally { // Explicit cast used for IEnumerator<T>. disposable = (IDisposable)enumerator; disposable.Dispose(); // IEnumerator will use the as operator unless IDisposable // support is known at compile time. // disposable = (enumerator as IDisposable); // if (disposable != null) // { // disposable.Dispose(); // } } }
public static void Main() { System.Collections.Generic.Stack <int> stack = new System.Collections.Generic.Stack <int>(); System.Collections.Generic.Stack <int> .Enumerator enumerator; IDisposable disposable; enumerator = stack.GetEnumerator(); try { int number; while (enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } } finally { // Explicit cast used for IEnumerator<T> disposable = (IDisposable)enumerator; disposable.Dispose(); // IEnumerator will use the as operator unless IDisposable // support is known at compile time // disposable = (enumerator as IDisposable); // if (disposable != null) // { // disposable.Dispose(); // } } }
static StackObject *GetEnumerator_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.Stack <ILRuntime.Runtime.Intepreter.ILTypeInstance> instance_of_this_method = (System.Collections.Generic.Stack <ILRuntime.Runtime.Intepreter.ILTypeInstance>) typeof(System.Collections.Generic.Stack <ILRuntime.Runtime.Intepreter.ILTypeInstance>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GetEnumerator(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public static void Main() { System.Collections.Generic.Stack <int> stack = new System.Collections.Generic.Stack <int>(); int number; using ( System.Collections.Generic.Stack <int> .Enumerator enumerator = stack.GetEnumerator()) { while (enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } } }
public static void Main() { System.Collections.Generic.Stack<int> stack = new System.Collections.Generic.Stack<int>(); int number; using( System.Collections.Generic.Stack<int>.Enumerator enumerator = stack.GetEnumerator()) { while(enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } } }
public static void Main() { System.Collections.Generic.Stack<int> stack = new System.Collections.Generic.Stack<int>(); int number; System.Collections.Generic.Stack<int>.Enumerator enumerator; // ... // If IEnumerable<T> is implemented explicitly, // then a cast is required. // ((IEnumerable<int>)stack).GetEnumerator(); enumerator = stack.GetEnumerator(); while(enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } }
public static bool IsLongHold(PhysicalKeys key) { if (IsKeyDown(key)) { longHolder.Push(new LongKeyData { AtTime = DateTime.Now, Key = key }); } var c = longHolder.Count; if (c < 10) { return(false); } var enumerator = longHolder.GetEnumerator(); long tick = 0; int count = 0; while (enumerator.MoveNext()) { if (enumerator.Current.Key != key) { return(false); } count++; tick += enumerator.Current.AtTime.Ticks / 1000; } var v = tick / count; var d = (DateTime.Now.Ticks) - v; var dt = new DateTime(d); return(true);// }
public static void Main() { System.Collections.Generic.Stack <int> stack = new System.Collections.Generic.Stack <int>(); int number; System.Collections.Generic.Stack <int> .Enumerator enumerator; // ... // If IEnumerable<T> is implemented explicitly, // then a cast is required // ((IEnumerable<int>)stack).GetEnumerator(); enumerator = stack.GetEnumerator(); while (enumerator.MoveNext()) { number = enumerator.Current; Console.WriteLine(number); } }