Hashtable initialization

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

In VS 2005, is there a way to create and initialize a hashtable in one
statement?

Something like (I know this isn't correct):

public static Hashtable cleanTables = ( new
Hashtable("PropertiesCleaned", "PropertyID"),
new
Hashtable("SubjectPropertiesCleaned","SubjectPropertyID"),
new
Hashtable("RoomCountsCleaned" ,"RoomCountID"));


Thanks,

Tom
 
tshad said:
In VS 2005, is there a way to create and initialize a hashtable in one
statement?

Something like (I know this isn't correct):

public static Hashtable cleanTables = ( new
Hashtable("PropertiesCleaned", "PropertyID"),
new
Hashtable("SubjectPropertiesCleaned","SubjectPropertyID"),
new
Hashtable("RoomCountsCleaned" ,"RoomCountID"));


No, this is a new feature en C# 3.0 (VS 2008). In 2005 you need to use
several statements to first create the hashtable and then add the items.
 
Alberto Poblacion said:
No, this is a new feature en C# 3.0 (VS 2008). In 2005 you need to use
several statements to first create the hashtable and then add the items.

That was what I thought.

Thanks,

Tom
 
Back
Top