Questions tagged [idictionary]

System.Collections.IDictionary and System.Collections.Generic.IDictionary interfaces in the BCL (Base Class Library) of the .NET framework represent a collection of key-value pairs.

System.Collections.IDictionary and System.Collections.Generic.IDictionary<TKey, TValue>interfaces in the BCL (Base Class Library) of the .NET framework represent a collection of key-value pairs.

MSDN links:

148 questions
4
votes
2 answers

IXmlSerializable Dictionary problem

I was trying to create a generic Dictionary that implements IXmlSerializable (credit to Charles Feduke). Here is my trial: Sub Main() Dim z As New SerializableDictionary(Of String, String) z.Add("asdf", "asd") …
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
4
votes
1 answer

Binding to indexed property with String key

Say I wanna bind to dictionary that TKey is string with XAML:
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
3
votes
2 answers

Best performance on a String Dictionary in C#

I am designing a C# class that contains a string hierarchy, where each string has 0 or 1 parents. My inclination is to implement this with a Dictionary where the key is the child and value is the parent. The dictionary may have a…
smartcaveman
  • 41,281
  • 29
  • 127
  • 212
3
votes
3 answers

The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an assembly reference?

Below is the sample I found from online Tutorial to host the website suing OWIN, however when I try to run on my machine, I got this error CS0246 The type or namespace name 'Func<,>' could not be found (are you missing a using directive or an…
ckky1213
  • 321
  • 5
  • 14
3
votes
4 answers

IEnumerable to IDictionary>

What's the most efficient way to convert an IEnumerable to an IDictionary> Where U is, for example a Guid, for which the information is held in a property of T. Basically, this creates a dictionary of lists where all items in…
Remus
  • 1,433
  • 3
  • 14
  • 24
3
votes
3 answers

Dictionaries look ugly in CLR Debugger (DbgCLR)

Dictionary values look ugly in CLR Debugger. Is there a way to make them appear in more friendly way? I want to see just keys and values instead of all these recursively nested properties. UPD: The best trade-off found so far: new…
thorn0
  • 9,362
  • 3
  • 68
  • 96
3
votes
1 answer

Why aren't IDictionary<_, > keys compatible with derived types?

type TypeA () = class end type TypeB () = inherit TypeA () // "The type 'TypeA' does not match the type 'TypeB'": let iDict : IDictionary = [ TypeB (), true; TypeB (), false ] |> dict let d = Dictionary () // This is OK,…
MiloDC
  • 2,373
  • 1
  • 16
  • 25
3
votes
2 answers

How can I return a Dictionary from F# to C# without having to include FSharp.Core?

I'm trying to return a IDictionary (created with dict tuplist) from F# to C#, but it says that I must include a reference to FSharp.Core because of System.Collections.IStructuralEquatable. I've tried returning a Dictionary<_,_>(dict…
Benjol
  • 63,995
  • 54
  • 186
  • 268
3
votes
10 answers

Removing Items From IDictionary With Recursion

Anybody have a slicker way to do this? Seems like it should be easier than this, but I'm having a mental block. Basically I need to remove items from an dictionary and recurse into the values of the items that are also dictionaries. private void…
Tim Scott
  • 15,106
  • 9
  • 65
  • 79
3
votes
1 answer

Creating a collection of generic generics - Dictionary covariance

I'm not sure how to better word the question, but I've run into the following problem with trying to create a Dictionary of generic interfaces more than once. Often this has come about when trying to create registry type collections which handle…
Nishmaster
  • 525
  • 3
  • 10
2
votes
1 answer

Error: Can't convert from Dictionary to IDictionary

Why is there an error Error 52 Argument 1: cannot convert from 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.IDictionary>' Dictionary> tempResultIDList = new…
2
votes
2 answers

Convert Dictionary to XML using C#

I have my XML File as follows:
testadd1
d1
add2
d2
Krishh
  • 4,111
  • 5
  • 42
  • 52
2
votes
1 answer

Howto call method extending IDictionary (reflection)?

I have extended IDictionary like this: public static T ToClass(this IDictionary source) where T : class, new() { T someObject = new T(); foreach (KeyValuePair item in source) { …
Lasse Edsvik
  • 9,070
  • 16
  • 73
  • 109
2
votes
2 answers

IDictionary w/ Null Key - MSDN Typo or something else going on?

IDictionary ArgumentNullException - key is null. Then, in the remarks... Implementations can vary in whether they allow key to be null. So, I have to wonder... is this an error or something I'm just missing here? The MSDN help file…
myermian
  • 31,823
  • 24
  • 123
  • 215
2
votes
2 answers

IDictionary AddAndReturn extension for fluent interface

What's nice about jQuery, which is a great JavaScript library, is to be able to get the element you are working on as return value. Here is an example of what I am referring to: $(function() { $("#poo").css("clear", "both").css("margin",…
tugberk
  • 57,477
  • 67
  • 243
  • 335
1 2
3
9 10