c# - Storing Class Instances In A Hashtable -


I have the property of public string X in the square Fu Fu.

I want to install Fu sometime as one and two, and add those examples in the hashtable bar with 1 and 1 keys respectively, how do I get string x for a specific example.

I have tried something: bar [1]. X, but property X is not recognized.

Am I doing wrong?

You dictionary < Int, foo & gt; Instead of hashtable . Hashtable is an obsolete class for those days which we did not have generic, it stores the key and value as the object type dictionary & lt; TKey, TValue & gt; , on the other hand, is a strongly typed general collection.

If you want to use Hashtable for some reason like C # 1.0), you have to enter the object:

  (( Foo) times [1]). X  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -