Posts Tagged ‘.Net’

Storing Multiple Values in Dictionary C#

October 9, 2015 Leave a comment

We All know the famous Dictionary

Dictionary<string,string> myDictionary

Its normally used for storing Key, Value pair.

Sometimes we want to store something like Key,Value,value.

for eg.

Dictionary<string,string,string> myDictionary

Unfortunately we don’t such structure in .Net, but there is workaround for such situation.

Create a Class or Struct and use it as Value.

for eg.

public class MyClass
public string Value1 { get; set; }
public string Value2 { get; set; }

Dictionary<string, MyClass> myDictionary


Hope this helps.

Categories: C#, Tips Tags: , ,