idictionary

Convert IDictionary<string, string> keys to lowercase (C#)

Hi, I've got a Method that gets a IDictionary as a parameter. Now I want to provide a method that retrieves the value from this dictionary, but it should be case-invariant. So my solution to this right now was to have a static function that loops through the keys and converts them toLower() like this: private static IDictionary<ILangua...

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 RemoveNotPermittedItems(ActionDictionary menu) { var keysToRemove = new List<string>()...

COM Interop IDictionary - How to retrieve a value in C#?

using: VS2008, C# I have a COM dll I need to use in a .NET project. In there I have a class with a method that returns an IDictionary object. IDictionary is defined in the COM dll so I'm not sure if it's the same as IDictionary in .NET. My problem: I know the dictionary keys and I want to retrieve the values. The documentation for this...

Error when calling the service in async mode

Stackoverflow is definetly the fastest forum so after posting this question in the WCF forum I decided to come here. I have a wcf service which returns a dictionary (IDictionary) and that works just fine. Now I wanted to add the capability of calling that service in async mode, but when the BeginMethod gets executed I get the following ...

NHibernate 2.0: Cfg.Configuration.SetProperties Issue with IDictionary

Hello I have a problem with: NHibernate.Cfg.Configuration.SetProperties() Not accepting the IDictionary: NHibernateConfigHandler I get the messages: Error 30 The best overloaded method match for 'NHibernate.Cfg.Configuration.SetProperties(System.Collections.Generic.IDictionary)' has some invalid arguments and Error 31 Argum...

Getting values of a generic IDictionary using reflection

I have an instance that implements IDictionary<T, K>, I don't know T and K at compiletime, and want to get all elements from it. I don't want to use IEnumerable for some reason, which would be the only non-generic interface implemented by IDictionary. Code I have so far: // getting types Type iDictType = instance.GetType().GetInterface...

Purpose of IDictionary interface

What is the need of IDictionary interface. How can IDictionary interface be initialized. After all it is just an interface. The following code snippet is from msdn. I could not understand it. IDictionary<string, string> openWith = new Dictionary<string, string>(); ...

How do I alter the contents of IDictionary using LINQ (C# 3.0)

How do I alter the contents of an IDictionary using C# 3.0 (Linq, Linq extensions) ? var enumerable = new int [] { 1, 2}; var dictionary = enumerable.ToDictionary(a=>a,a=>0); //some code //now I want to change all values to 1 without recreating the dictionary //how it is done? ...

IDictionary, Dictionary

I have: IDictionary<string, IDictionary<string, IList<long>>> OldDic1; (just for illustration purposes, it is instantiated and has values - somewhere else) Why can I do this: ? Dictionary<string, IDictionary<string, IList<long>>> dic1 = OldDic1 as Dictionary<string, IDictionary<string, IList<long>>>; Basically dic1 after execut...

<Map> = IDictionary.

I have 3 entities: class User {id,name...} class UserUrl {id,user_id,url,url_type_id} class UrlType {id,name} My mapping: <class name="User" table="Users" lazy="false">   <id name="id" type="Int32" column="id">     <generator class="identity" />   </id>   <property name="name" column="name" type="String"/>   <map name="Urls" table="User...

Binding to indexed property with String key

Say I wanna bind to dictionary that TKey is string with XAML: <Label DataContext="{MyDictionary}" Content="{Binding Item("OK")}" /> Doesn't work. How should I do it? I am talking about the Item("Key") ...

NHibernate IDictionary mapping with link table

I am a newbie to NHibernate and trying to create a XML mapping for this scenario: public class Catalog { public virtual Guid ID { get; set; } public virtual string Name { get; set; } public virtual IDictionary<string, Product> Products { get; set; } } The key in the IDictionary is the name of the Product. public class Pro...

C# -- Need an IDictionary implementation that will allow a null key

Basically, I want something like this: Dictionary<object, string> dict = new Dictionary<object, string>(); dict.Add(null, "Nothing"); dict.Add(1, "One"); Are there any built into the base class library that allow this? The preceding code will throw an exception at runtime when adding the null key. Thanks ...

Is there a better data structure than Dictionary if the values are objects and a property of those objects are the keys?

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, obj> is a field in a container class that allows for random indexing into the obj values based on an int id number. The simplified (no exception ha...

Fluent NHibernate HasManyToMany IDictionary

I have three tables: Employee, EmployeesCustomer, and Customer. Employee has a primary key called Id. Customer has a primary key called Id. EmployeesCustomer has a composite key made up of two fields, EmployeeId and CustomerId. The EmployeesCustomer does NOT contain any other fields. My goal is to create an IDictionary on the Employee...

Create a Dictionary in xaml?

Pseudo example: <Window> <Window.Tag> <x:Dictionary KeyType="{x:Type sys:String}" ValueType="{x:Type sys:Int32}"> <sys:DictionaryEntry Entry="{sys:DictionaryEntry Key0, 000}"/> <sys:DictionaryEntry Key="key1" Value="111"/> <sys:DictionaryEntry> <sys:DictionaryEntry.Key> <sys:String>Key...

How do I enumerate a static dictionary contained in a static class from asp.net ( aspx) page

I don't understand how to loop over a static dictionary contained in a static class from my aspx page. I have this for the static class public static class ErrorCode { public static IDictionary<int, string> ErrorCodeDic; static ErrorCode() { ErrorCodeDic = new Dictionary<int, string>() { {1, ...

XML Serialization of nested classes having Dictionary

I am trying to XML-serialize a nested class. Both classes have dictionaries which I am serializing using this link. Serialization works fine but the nested class doesn't get de-serialized. Can you please let me know how to do it? ...

Fluent nHibernate and mapping IDictionary<DaysOfWeek,IDictionay<int, decimal>> how to?

Hello, I have problem with making mapping of classes with propert of type Dictionary and value in it of type Dictionary too, like this: public class Class1 { public virtual int Id { get; set; } public virtual IDictionary<DayOfWeek, IDictionary<int, decimal>> Class1Dictionary { get; set; } } My mapping looks like this: ...

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

I'm trying to return a IDictionary<int,int> (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 tuplist), but that doesn't make any difference. I even tried Dictionary<_,_>(dict tuplist, Hash...