idictionary Questions

8

Solved

Basically, I want something like this: Dictionary<object, string> dict = new Dictionary<object, string>(); dict.Add(null, "Nothing"); dict.Add(1, "One"); Are there ...
Rovner asked 16/12, 2009 at 18:50

4

Solved

My scenario, how to convert List<KeyValuePair<string, string>> into IDictionary<string, string>?
Sheerlegs asked 26/10, 2010 at 9:26

2

Solved

I have a method that returns an IEnumerable<KeyValuePair<string, ArrayList>>, but some of the callers require the result of the method to be a dictionary. How can I convert the IEnumera...
Xhosa asked 14/4, 2010 at 10:31

4

Solved

This is probably a very simple question but google has let me down sofar and keeps pointing me towards python solutions. I have a webpage where applciations/users can supply querystringparameters....
Counterreply asked 11/9, 2014 at 6:53

2

Solved

I'm trying to remove all elements in a IDictionary object that match a condition. E.g. the IDictionary contains a set of keys and corresponding values (let say 80 objects). The keys are strings, t...
Woad asked 10/5, 2014 at 22:43

2

Solved

I would like to know if it is possible to remove an IDictionary item by its key and in the same time get its actual value that has been removed? Example something like: Dictionary<strin...
Reedy asked 28/8, 2018 at 17:1

5

Solved

I have a static class in which I am using dictionaries as lookup tables to map between .NET types and SQL types. Here is an example of such a dictionary: private static readonly Dictionary<Type...

2

Solved

How would I iterate through the keys and values of an IDictionary if I don't know the concrete types of the keys and values within, therefore want to just treat them as objects? If I do something ...
Dnieper asked 24/3, 2017 at 15:40

1

I have a System.Collections.Generic.Dictionary object in my code and am trying to view its contents while stopped at a breakpoint in the Visual Studio debugger. The Dictionary class in .NET of cour...
Berners asked 4/11, 2014 at 16:17

4

Solved

Pseudo example: <Window> <Window.Tag> <x:Dictionary KeyType="{x:Type sys:String}" ValueType="{x:Type sys:Int32}"> <sys:DictionaryEntry Entry="{sys:DictionaryEntry Key0, 000...
Suzetta asked 23/2, 2010 at 15:13

3

Solved

My question is similar to the previous one, but the answer to that question is inapplicable to this one. Well, I want to write an extension method for both IDictionary and IReadOnlyDictionary inter...
Twirp asked 5/9, 2013 at 16:40

1

Solved

There is this answer of a query I am trying to understand what to put into this LINQ segment pair => pair.Key, pair => pair.Value My exact List definition is this: List<Dictionary&lt...
Assail asked 24/3, 2015 at 19:7

7

I have a: var selectedDates = new Dictionary<string, string>(); selectedDates.Add("2014-06-21", DateTime.Now.ToLongDateString()); selectedDates.Add("2014-07-21", DateTime.Now.AddDays(5...
Bigg asked 28/7, 2014 at 14:12

2

Solved

The documentation states that bool Dictionary<TKey, TValue>.ContainsKey(TKey key) throws an exception in case a null key is passed. Could anyone give a reason for that? Wouldn't it be m...
Pointenoire asked 6/12, 2013 at 15:45

3

Solved

Consider this code: var variables = System.Environment.GetEnvironmentVariables(); foreach (DictionaryEntry vari in variables) { Console.WriteLine(vari.Key); Console.WriteLine(vari.Value); } It...
Incontrollable asked 21/10, 2013 at 8:38

3

Solved

For example if you check these two extension methods the only difference is type of htmlAttributes so you can pass your htmlAttributes in two different ways: public static MvcHtmlString TextBoxFor...
Gagliardi asked 16/11, 2011 at 23:36

4

Solved

I have a Dictionary<int, object> where the int is a property of obj. Is there a better data structure for this? I feel like using a property as the key is redundant. This Dictionary<int, ...
Grantham asked 28/1, 2010 at 12:31

2

Solved

I've read the MSDN documentation on how Dictionary.ContainsKey() works, but I was wondering how it actually makes the equality comparison? Basically, I have a dictionary keyed to a reference type* ...
Worry asked 7/11, 2012 at 1:42

1

Solved

I receive the above error message when performing a unit test on a method. I know where the problem is at, I just don't know why it's not present in the dictionary. Here is the dictionary: var nmDi...
Compulsive asked 15/8, 2012 at 15:29

2

I'm not sure if I'm doing something wrong here or if it needs to be fixed... I have a custom Dictionary wrapper class and here is a snippet of the code that is necessary. public int Count { get ...
Tertial asked 14/9, 2011 at 15:42

1

Solved

I wanted to create a Dictionary-like object and thought the correct way would be to implement the IDictionary<K,V> interface, and use composition to include the underlying dictionary. I began...
Noonday asked 26/8, 2011 at 21:15

3

Solved

Please consider the following code: class Student { } enum StudentType { } static void foo(IDictionary<StudentType, IList<Student>> students) { } static void Main(string[] args) { ...
Panay asked 17/5, 2011 at 10:42

3

Solved

When I have SortedDictionary<TK, TV> in .NET and I want to enumerate it as ICollection<KeyValuePair<TK, TV>> does it enumerate in expected order? That is KeyValuePair<TK, TV&...
Winkle asked 23/4, 2011 at 15:58

7

Solved

I have about 3000 different files I need to organize, and retrieve at different times during the game. I created my own struct of variables. I was thinking about creating a "Dictionary " at the b...
Mcatee asked 11/8, 2010 at 16:46

2

Solved

IDictionary<TKey, TValue> inherits from IEnumerable<KeyValuePair<TKey, TValue>>, but IDictionary for some reason doesn't inherit from IEnumerable<DictionaryEntry>. I wonder ...
Crumble asked 18/6, 2010 at 10:51

© 2022 - 2024 — McMap. All rights reserved.