I've created a dictionary of a simple structure
The intent is that the KEY for the dictionary when I create an element will be the IPV4 IP Address of the client.
So I add an element to the dictionary as follows
Later in my code I want to change values to the structure in the dictionary like this:
The problem is that it complains: "The expression is a value and therefore cannot be the target of an assignment"
But this works:
So I am updating the entire structure. Why won't it let me update just one element of the structure.
Code:
Private Enum ClientStatus
Alive = 0
Zombie = 1
Corpse = 2
End Enum
Private Structure ClientHeartbeat_type
Dim Timestamp as DateTime
Dim Status as ClientStatus
End Structure
Private ClientList as Dictionary(of String, ClientHeartbeat_type)
So I add an element to the dictionary as follows
Code:
Dim MyClient as new ClientHeartbeat_type with {.status = Clientstatus.Zombie, .Timestamp = Now}
ClientList.add(ClientIP, MyClient)
Code:
ClientList(ClientIPAddress).Status = ClientStatus.Alive
But this works:
Code:
ClientList(ClientIP) = New ClientHeartbeat_type with {.status = Clientstatus.Alive, .Timestamp = Now}