コード例 #1
0
 /// <summary>
 ///     Gets the specified registered task from the collection.
 /// </summary>
 /// <param name="index"> The index of the registered task to be retrieved. </param>
 /// <returns>
 ///     A <see cref="Task" /> instance that contains the requested context.
 /// </returns>
 public Task this[int index] {
     get {
         var i = 0;
         if (v2Coll != null)
         {
             if (filter == null)
             {
                 return(new Task(svc, v2Coll[++index]));
             }
             else
             {
                 var v2te = new V2TaskEnumerator(fld, v2Coll, filter);
                 while (v2te.MoveNext())
                 {
                     if (i++ == index)
                     {
                         return(v2te.Current);
                     }
                 }
             }
         }
         else
         {
             var v1te = new V1TaskEnumerator(svc, filter);
             while (v1te.MoveNext())
             {
                 if (i++ == index)
                 {
                     return(v1te.Current);
                 }
             }
         }
         throw new ArgumentOutOfRangeException();
     }
 }
コード例 #2
0
 public Task this[int index]
 {
     get
     {
         var num = 0;
         if (_v2Coll != null)
         {
             if (_filter == null)
             {
                 return(new Task(_svc, _v2Coll[++index]));
             }
             var enumerator = new V2TaskEnumerator(_fld, _v2Coll, _filter);
             while (enumerator.MoveNext())
             {
                 if (num++ == index)
                 {
                     return(enumerator.Current);
                 }
             }
         }
         else
         {
             var enumerator2 = new V1TaskEnumerator(_svc, _filter);
             while (enumerator2.MoveNext())
             {
                 if (num++ == index)
                 {
                     return(enumerator2.Current);
                 }
             }
         }
         throw new ArgumentOutOfRangeException();
     }
 }
コード例 #3
0
 /// <summary>
 /// Gets the specified registered task from the collection.
 /// </summary>
 /// <param name="index">The index of the registered task to be retrieved.</param>
 /// <returns>A <see cref="Task"/> instance that contains the requested context.</returns>
 public Task this[int index]
 {
     get
     {
         int i = 0;
         if (v2Coll != null)
         {
             if (filter == null)
             {
                 return(Task.CreateTask(svc, v2Coll[++index]));
             }
             else
             {
                 V2TaskEnumerator v2te = new V2TaskEnumerator(this.fld, this.v2Coll, this.filter);
                 while (v2te.MoveNext())
                 {
                     if (i++ == index)
                     {
                         return(v2te.Current);
                     }
                 }
             }
         }
         else
         {
             V1TaskEnumerator v1te = new V1TaskEnumerator(this.svc, this.filter);
             while (v1te.MoveNext())
             {
                 if (i++ == index)
                 {
                     return(v1te.Current);
                 }
             }
         }
         throw new ArgumentOutOfRangeException();
     }
 }