Will try to fetch then remove an item at index, returning true if succeeded.

/// <summary>Retrieves and removes an item from the list.</summary>
/// <typeparam name="T">The type that the generic list contains.</typeparam>
/// <param name="list">The list.</param>
/// <param name="index">The index of the item to be pulled out of the list.</param>
/// <param name="value">The value that was retrieved from the list.</param>
/// <returns>true if successful; otherwise false.</returns>
public static bool TryPullItemAt<T>(this IList<T> list, int index, out T value)
        value = list[index];
        return true;
        value = default(T);
        return false;

Add comment

  • Comment
  • Preview

Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume