Helper methods with regard to objects, types, properties, etc.

Not intended to be used directly by applications.

Esempio n. 1
0
 /// <summary>
 /// Returns the element at the specified index using the supplied
 /// <paramref name="enumerable"/>.
 /// </summary>
 /// <param name="enumerable">
 /// The <see cref="System.Collections.IEnumerable"/> to use to enumerate
 /// elements until the supplied <paramref name="index"/> is reached.
 /// </param>
 /// <param name="index">
 /// The index of the element in the enumeration to return.
 /// </param>
 /// <returns>
 /// The element at the specified index using the supplied
 /// <paramref name="enumerable"/>.
 /// </returns>
 /// <exception cref="System.ArgumentOutOfRangeException">
 /// If the supplied <paramref name="index"/> was less than zero, or the
 /// supplied <paramref name="enumerable"/> did not contain enough elements
 /// to be able to reach the supplied <paramref name="index"/>.
 /// </exception>
 /// <exception cref="System.ArgumentNullException">
 /// If the supplied <paramref name="enumerable"/> is <see langword="null"/>.
 /// </exception>
 public static object EnumerateElementAtIndex(IEnumerable enumerable, int index)
 {
     AssertUtils.ArgumentNotNull(enumerable, "enumerable");
     return(ObjectUtils.EnumerateElementAtIndex(enumerable.GetEnumerator(), index));
 }
Esempio n. 2
0
 /// <summary>
 /// Returns the first element in the supplied <paramref name="enumerator"/>.
 /// </summary>
 /// <param name="enumerator">
 /// The <see cref="System.Collections.IEnumerator"/> to use to enumerate
 /// elements.
 /// </param>
 /// <returns>
 /// The first element in the supplied <paramref name="enumerator"/>.
 /// </returns>
 /// <exception cref="System.IndexOutOfRangeException">
 /// If the supplied <paramref name="enumerator"/> did not have any elements.
 /// </exception>
 public static object EnumerateFirstElement(IEnumerator enumerator)
 {
     return(ObjectUtils.EnumerateElementAtIndex(enumerator, 0));
 }