By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Synchronized Method for a Collection

P: n/a
I have created a Collection class inherited from the CollectionBase Class.

How would I implement a Synchronized method similar to the Synchronised
method of the HashTable Class.

Thanks,
Fred
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Fred,

There are a number of ways you COULD do it. HashTable defines a private
class which inherits from Hashtable and overrides the key methods (Add,
Clear etc). It implements the methods by performing the relevant actions in
a SyncLock block. The Synchronised method returns an instance of this
class.

Hope this helps,

Nick Hall

"fred" <fr**@NoSpam.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
I have created a Collection class inherited from the CollectionBase Class.

How would I implement a Synchronized method similar to the Synchronised
method of the HashTable Class.

Thanks,
Fred

Nov 20 '05 #2

P: n/a
Thanks Nick.
"Nick Hall" <ni***@aslan.nospam.co.uk> wrote in message
news:uf****************@TK2MSFTNGP09.phx.gbl...
Fred,

There are a number of ways you COULD do it. HashTable defines a private
class which inherits from Hashtable and overrides the key methods (Add,
Clear etc). It implements the methods by performing the relevant actions in a SyncLock block. The Synchronised method returns an instance of this
class.

Hope this helps,

Nick Hall

"fred" <fr**@NoSpam.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
I have created a Collection class inherited from the CollectionBase Class.
How would I implement a Synchronized method similar to the Synchronised
method of the HashTable Class.

Thanks,
Fred


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.