C
CoderHead
I've got a Web app wherein I store a number of generic collections
(Generic.List) in the application-scope as a HashTable (a make-shift
cache), indexed by an Enum value - i.e.,
CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.Recruiting, TableList). The Enum
values are as follows:
Enum DataAttribute.Database
Data = 0
DataAccess = 1
EventLog = 2
Recruiting = 3
End Enum
I load each of the collections using a method that I call with each of
the four Enum values. Each collection contains a List of a class
called SystemTable that, among other things, contains a property called
"Database" - a DataAttribute.Database Enum value, like so:
Public Property Database() As DataAttribute.Database
Get
Return InDatabase
End Get
Set(ByVal Value As DataAttribute.Database)
InDatabase = Value
End Set
End Property
As I load each collection into the application-scope HashTable, the
previously-added HashTable items are being modified. For instance,
let's say that the first collection I add is
CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.Data, TableList), where each
SystemTable in TableList has a "Database" property value of "Data."
When I add the second item (CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.DataAccess, TableList)), I find
that each one of my SystemTable instances in the first item (Data) now
have a "Database" property value of "DataAccess."
How in the world is the .Add method on HashTable modifying a single
property value of each of the members of an item contained in the
collection? Why isn't it changing the "ID" property or the "Name"
property? Since when does the .Add property modify existing members
anyway?
(Generic.List) in the application-scope as a HashTable (a make-shift
cache), indexed by an Enum value - i.e.,
CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.Recruiting, TableList). The Enum
values are as follows:
Enum DataAttribute.Database
Data = 0
DataAccess = 1
EventLog = 2
Recruiting = 3
End Enum
I load each of the collections using a method that I call with each of
the four Enum values. Each collection contains a List of a class
called SystemTable that, among other things, contains a property called
"Database" - a DataAttribute.Database Enum value, like so:
Public Property Database() As DataAttribute.Database
Get
Return InDatabase
End Get
Set(ByVal Value As DataAttribute.Database)
InDatabase = Value
End Set
End Property
As I load each collection into the application-scope HashTable, the
previously-added HashTable items are being modified. For instance,
let's say that the first collection I add is
CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.Data, TableList), where each
SystemTable in TableList has a "Database" property value of "Data."
When I add the second item (CType(Application.Item("SysTables"),
HashTable).Add(DataAttribute.Database.DataAccess, TableList)), I find
that each one of my SystemTable instances in the first item (Data) now
have a "Database" property value of "DataAccess."
How in the world is the .Add method on HashTable modifying a single
property value of each of the members of an item contained in the
collection? Why isn't it changing the "ID" property or the "Name"
property? Since when does the .Add property modify existing members
anyway?