will be helpful for those in need The important thing to remember is that the first time you encounter a new room you need to instantiate its Dictionary. Add something like this at the location of your comment:
roomfurnitures[roomtype] = new Dictionary<string, string>(); // the first time we've seen this
// get the dictionary for the specific room
var room = roomfurnitures[roomtype];
// now we can add the furniture to the room
room[item] = description;
C# Sum of Values in a nested dictionary where value is a class Dictionary<string, Dictionary<Int16, CommonData>
I wish this helpful for you I tried: , I think you don't understand dictionaries. Check this example:
var foo = new Dictionary<string, Dictionary<string, List<MyCustomClass>>>();
// Add some content to foo.
string nameOfMyList = ""; // Something that exists as a key in foo.
Dictionary<string, List<MyCustomClass>> result = foo[nameOfMyList];
Select minimum key value pair in List<Dictionary<string,string>> where dictionary value is a date as string
it fixes the issue Here is one way to do it, order it by key and get the first element. This works because of the way the key is structured in your dictionary instances, DateTime.ToString("s") produces a sortable date time string (its ISO notation), there is no need to convert it to a DateTime type. The SelectMany will flatten the dictionary instances into a single collection. Using OrderBy will order ascending (earliest to latest).
var result = differences.SelectMany(y => y).OrderBy(x => x.Key).First();
Building LINQ query to get List of Dictionaries from Dictionary of string/HashSet of Dictionary of String/String?