Click here to Skip to main content
15,890,527 members
Home / Discussions / C#
   

C#

 
GeneralRe: dll reference Pin
Peterson Luiz24-Jan-08 8:20
Peterson Luiz24-Jan-08 8:20 
GeneralRe: dll reference Pin
Brad Grace24-Jan-08 15:51
Brad Grace24-Jan-08 15:51 
QuestionEncrypting a stream Pin
Schokoolero23-Jan-08 7:18
Schokoolero23-Jan-08 7:18 
GeneralRe: Encrypting a stream Pin
Giorgi Dalakishvili23-Jan-08 7:51
mentorGiorgi Dalakishvili23-Jan-08 7:51 
GeneralRe: Encrypting a stream Pin
Schokoolero23-Jan-08 8:17
Schokoolero23-Jan-08 8:17 
GeneralRe: Encrypting a stream Pin
DaveyM6923-Jan-08 9:14
professionalDaveyM6923-Jan-08 9:14 
GeneralRe: Encrypting a stream Pin
Skippums23-Jan-08 10:35
Skippums23-Jan-08 10:35 
QuestionExtending Hashtable - is there a better way? [modified] Pin
Clive D. Pottinger23-Jan-08 6:59
Clive D. Pottinger23-Jan-08 6:59 
Hello everyone.

Some time ago, I was working with Hashtables when I found a limitation: as an example I will use the following:
Hashtable countryInfo = new HashTable();
countryInfo.Add("Canada", "Ottawa");
countryInfo.Add("UK", "London");
countryInfo.Add("France", "Paris");
...

This is great: given the country France, I can find out that it's capital is Paris:
string capital = countryInfo["France"]
What I can't do is find out is what country is Paris the capital of (without looping through the table).

So I created MultiHashTable which, instead of holding key,value pairs, holds key,key,key... sets. I can now do things like:
MultiHashTable countryInfo = new MultiHashTable("Country", "Capital", MultiHashTable.Unkeyed("Language"));
countryInfo.Add("Canada", "Ottawa", "English");
countryInfo.Add("UK", "London", "English");
countryInfo.Add("France", "Paris", "French");

(note: the "Language" table is "Unkeyed" because it must hold duplicate entries for Canada and UK).

Now I can find out what country has Paris as it's capital:
capital = countryInfo.GetItem("Country", "Capital", "Paris");
and other things that I needed to do.

My question is this - did I re-invent the wheel? I keep discovering all kinds of stuff already built into C# and I can't help but think that this sort of thing is already in there somewhere.

I won't consider my time wasted if it is - creating MultiHashTable was a great learning experience - I just want to know if at some time in the future someone is going to say "well why don't you just use System.Collections.SuperCrossRef like everybody else?"

Clive Pottinger
Victoria, BC

modified on Wednesday, January 23, 2008 1:42:53 PM

GeneralRe: Extending Hashtable - is there a better way? Pin
engsrini23-Jan-08 8:43
engsrini23-Jan-08 8:43 
GeneralCreating a WPF app with notpad and command-line compiler. Pin
CataclysmicQuantum23-Jan-08 6:29
CataclysmicQuantum23-Jan-08 6:29 
GeneralRe: Creating a WPF app with notpad and command-line compiler. Pin
led mike23-Jan-08 6:54
led mike23-Jan-08 6:54 
GeneralRe: Creating a WPF app with notpad and command-line compiler. Pin
CataclysmicQuantum23-Jan-08 7:03
CataclysmicQuantum23-Jan-08 7:03 
GeneralRe: Creating a WPF app with notpad and command-line compiler. Pin
led mike23-Jan-08 7:19
led mike23-Jan-08 7:19 
GeneralRe: Creating a WPF app with notpad and command-line compiler. Pin
CataclysmicQuantum23-Jan-08 7:37
CataclysmicQuantum23-Jan-08 7:37 
GeneralRe: Creating a WPF app with notpad and command-line compiler. Pin
NormDroid25-Jan-08 10:05
professionalNormDroid25-Jan-08 10:05 
GeneralName of DLL [SOLVED] Pin
#realJSOP23-Jan-08 5:24
mve#realJSOP23-Jan-08 5:24 
GeneralRe: Name of DLL [SOLVED] Pin
Justin Perez23-Jan-08 5:37
Justin Perez23-Jan-08 5:37 
QuestionGenerics [modified] Pin
ArneKruger23-Jan-08 4:06
ArneKruger23-Jan-08 4:06 
GeneralRe: Generics Pin
Alan Balkany23-Jan-08 4:18
Alan Balkany23-Jan-08 4:18 
GeneralRe: Generics [modified] Pin
ArneKruger23-Jan-08 4:31
ArneKruger23-Jan-08 4:31 
GeneralRe: Generics Pin
Alan Balkany23-Jan-08 4:40
Alan Balkany23-Jan-08 4:40 
GeneralRe: Generics Pin
Pete O'Hanlon23-Jan-08 4:35
mvePete O'Hanlon23-Jan-08 4:35 
GeneralRe: Generics Pin
led mike23-Jan-08 4:37
led mike23-Jan-08 4:37 
GeneralRe: Generics Pin
Roger Alsing23-Jan-08 5:06
Roger Alsing23-Jan-08 5:06 
GeneralRe: Generics Pin
ArneKruger23-Jan-08 5:50
ArneKruger23-Jan-08 5:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.