Exemple #1
0
        /// <summary>
        /// Gets the object by index if it exists.
        /// </summary>
        /// <param name="list">The list.</param>
        /// <param name="index">The index.</param>
        /// <param name="def">The default value.</param>
        /// <returns>Object for the list, <c>default(T)</c> otherwise.</returns>
        public static T GetObjectByIndexSafe <T>(IIndexedContainer <T> list, int index, T def)
        {
            T ret = def;

            if (list != null && list.Count >= 0 && index >= 0 && index < list.Count)
            {
                ret = list[index];
            }

            return(ret);
        }
Exemple #2
0
 public IndexedContainerEnumerator(IIndexedContainer <T> container)
 {
     _container = container;
     Reset();
 }