CSharp examples for System.Collections:Hashtable
Reverse Hashtable: keys become values, and values become keys
/*// w ww .j a v a 2 s .com * Copyright (c) 2005 Poderosa Project, All Rights Reserved. * $Id: RCollectionUtil.cs,v 1.2 2005/04/20 08:45:45 okajima Exp $ */ using System.Collections; using System; public class Main{ public static Hashtable ReverseHashtable(Hashtable src) { Hashtable r = new Hashtable(); IDictionaryEnumerator ie = src.GetEnumerator(); while(ie.MoveNext()) { r.Add(ie.Value, ie.Key); } return r; } }