Q: How to get member of a generic list, stack and map in C#? In Java, you could do this:
To get a member of a generic list:
public T getMember(int index){
    return list.get(index);
}

To get a member of a generic stack:
public T getMemberFromStack(int index){
     return stack.get(index); 
}

And to get a member of a generic map:
public T getMemberFromMap(K key){
    return map.get(key);
}

I have been looking through 
https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/3278tedw(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx
But I could not find a similar method in C#.
These methods should return the objects without removing them from list/stack/map.

A: For List<T>:
public T GetMember(int index)
{
    return list[index];
}

For Stack<T> (Why would you ever get a specific element on a stack?):
public T GetMemberFromStack(int index)
{
    return stack.ElementAt(index);
}

For Dictionary<T, K>:
public T GetMemberFromMap(K key)
{
    return map[key];
}


A: Unlike Java, C# allows you to overload operators. That is what the library designers did: rather than providing get(int) or get(K) methods, they provided an overload for the [] operator:
public T getMember(int index){
    return list[index];
}

public T getMemberFromMap(K key){
    return map[key];
}

An important difference between Java's Map<K,V> and C#'s Dictionary<K,V> is that Java's get would return null for a missing key, while C#'s operator [] would throw an exception.
