Need a .NET Dictionary<string,object> with just a little more functionality.

Posted by Ronnie Overby on Stack Overflow See other posts from Stack Overflow or by Ronnie Overby
Published on 2010-04-01T17:51:13Z Indexed on 2010/04/01 17:53 UTC
Read the original article Hit count: 318

Filed under:
|

I need a dictionary but I also need to store a boolean value about the object in the dictionary. What's the best way for this.

Something like

Dictonary<string,object,bool> 

would be ideal, but doesn't exist.

My first idea was:

public class SomeObject
{
    public object Value { get; set; }
    public bool Flag { get; set; }
}
// and then use:
Dictionary<string,SomeObject> myDictionary;

My 2nd idea was to implement IDictionary and contain two dictionaries within that were manipulated by the implemented methods and property accessors.

My 3rd idea was to see what the folks at StackOverflow would do.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#