Exemplo n.º 1
0
 /// <summary>Initializes a new instance of the <see cref="IEnumFromNext{TItem}"/> class.</summary>
 /// <param name="next">The method used to try to get the next item in the enumeration.</param>
 /// <param name="reset">The method used to reset the enumeration to the first element.</param>
 public IEnumFromCom(ComTryGetNext next, Action reset) : base()
 {
     if (next == null || reset == null)
     {
         throw new ArgumentNullException();
     }
     cnext      = next;
     base.next  = TryGet;
     base.reset = reset;
 }
Exemplo n.º 2
0
 /// <summary>Initializes a new instance of the <see cref="IEnumFromNext{TItem}"/> class.</summary>
 /// <param name="next">The method used to try to get the next item in the enumeration.</param>
 /// <param name="reset">The method used to reset the enumeration to the first element.</param>
 /// <param name="makeNew">The method used to create the default value placed in the array for <paramref name="next"/>.</param>
 public IEnumFromCom(ComTryGetNext next, Action reset, Func <TItem> makeNew = null) : base()
 {
     if (next is null || reset is null)
     {
         throw new ArgumentNullException();
     }
     cnext      = next;
     make       = makeNew ?? DefaultMaker;
     base.next  = TryGet;
     base.reset = reset;
 }
Exemplo n.º 3
0
 /// <summary>Initializes a new instance of the <see cref="IEnumFromCom{TItem}"/> class from a COM enumeration interface instance.</summary>
 /// <param name="enumObj">The COM enumeration interface instance.</param>
 public IEnumFromCom(ICOMEnum <TItem> enumObj) : base()
 {
     cnext      = (ComTryGetNext)Delegate.CreateDelegate(typeof(ComTryGetNext), enumObj, "Next");
     base.next  = TryGet;
     base.reset = (Action)Delegate.CreateDelegate(typeof(Action), enumObj, "Reset");
 }