NateS NateS - 7 months ago 54
C# Question

How to pull the key value based on the key that is inside the Dictionary?

Let's say I did the following:

Dictionary<string,NetworkStream> dictionary = new Dictionary<string,NetworkStream>();

How do I pull the
of Jack? Assuming I have multiple of lines likes this.

UPDATE: I didn't explain myself well, sorry. If the name is already exists I'm not going to add him to the dictionary.. I meant if I have different names.


Dictionary cannot have more than one key with same name, still you can access the value of 'Jack' like this,

value = dictionary["Jack"];