Copy: Hashtable to Properties



Hello,

I have a values stored in a Hashtable hash and I want assign them as
properties to an object obj

obj.x1 = (String)hash[x1];
obj.x2 = (long)hash[x2];
obj.x3 = (int)[x3];
.....


Is there a better (more reusable) way, like this Pseudocode:

foreach (DictionaryEntry de in hash) {
obj.(de.key) = (de.Value.GetType())hash[de.Value];
}

Thanks!


.