I need to create a Hashtable that is a singleton and is
synchronized
for many readers and writers. I can, of course, create a
custom class
which has a hashtable as a member and lock the hashtable,
but that
would require me to create a wrapper function for each
hashtable
function I need. Instead, I've done this:
class MyCache : Hashtable
{
private static MyCache Instance = new MyCache();
public static Hashtable GetInstance()
{
return Synchronized(Instance);
}
}
I'm wondering if this is ideal (and safe, of course) or if
there is a
more appropriate way to do accomplish what I'm trying to do.
Thanks in advance . . .
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharp googlegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups-beta.google.com/group/C_Sharp?hl=en
-~----------~----~----~----~------~----~------~--~---
|