I'm starting to learn C# (by my own, so far, with a teacher soon).
I'd like to create a linked list able to store 2 variables.
I'm working with TCP connections, and one of these variables is obviously the client socket, which is the only one I'm storing right now:
C# code:
private LinkedList<Socket> list = new LinkedList<Socket>();
I also want to store a string, representing the client name, for example.
Is that possible?
I thought of creating a new structure ("transcoding" what I learned on C), but I'd need to use pointers, and I read somewhere C# has no pointers...
Edit: reading the reference on MSDN I found a Dictionary. Do you think replacing the linked list by the dictionary would work?
The methods I need are Add, RemoveFirst, Cound and I also use:
C# code:
foreach(Socket s in list) //cmd
I'm afraid it's not possible due to this:
C# code:
while (list.Count != 0) list.RemoveFirst(); // this is using LinkedList
I don't think I can remove one element without telling which on, right?