G
Guest
Hi! I need to compare objects that I store in HashTable by using Add method
and passing object as first param, and a unique key string as second. Later
on I iterate through this collection and need to compare the object stored in
the HashTable to another object that's obtained as one of the params in a
call to an event.
Example code (i'm skipping most declarations to avoid long post):
Private Shared Sub OnChanged(ByVal source As Object, ByVal e As
FileSystemEventArgs)
Dim fsw as FileSystemWatcher
fsw = source
myEnumerator = hshtable.GetEnumerator()
While myEnumerator.MoveNext
if myEnumerator.Value Is fsw then
'do something if the object is the same
end if
End While
I also tried using myEnumerator.Current when performing comparison, as well
as trying to cast the .Value and .Current to the same type of object that I
compare it to (FileSystemWatcher). I'm open to any suggestions. The basic
goal of what I'm doing is to store a reference to an object and an associated
string somewhere so that I can later when the event of FileSystemObject fires
identify that object and associated string to perform some relevant action.
I have a pretty short Deadline on this so any help would be appreciated!
Thanks!
and passing object as first param, and a unique key string as second. Later
on I iterate through this collection and need to compare the object stored in
the HashTable to another object that's obtained as one of the params in a
call to an event.
Example code (i'm skipping most declarations to avoid long post):
Private Shared Sub OnChanged(ByVal source As Object, ByVal e As
FileSystemEventArgs)
Dim fsw as FileSystemWatcher
fsw = source
myEnumerator = hshtable.GetEnumerator()
While myEnumerator.MoveNext
if myEnumerator.Value Is fsw then
'do something if the object is the same
end if
End While
I also tried using myEnumerator.Current when performing comparison, as well
as trying to cast the .Value and .Current to the same type of object that I
compare it to (FileSystemWatcher). I'm open to any suggestions. The basic
goal of what I'm doing is to store a reference to an object and an associated
string somewhere so that I can later when the event of FileSystemObject fires
identify that object and associated string to perform some relevant action.
I have a pretty short Deadline on this so any help would be appreciated!
Thanks!