>>Have you tried using a lock ?
>>
>>In the code below, anyone accessing Tables will block if Tables is being reinitialized
>>
>>
>> public class AClass
>> {
>> private Dictionary<string, string> Tables_;
>> private object TableLocker = new Object();
>>
>>
>> public Dictionary<string, string> Tables
>> {
>> get
>> {
>> lock (TableLocker)
>> {
>> return Tables_;
>> }
>> }
>> private set
>> {
>> Tables_ = value;
>> }
>> }
>>
>> public void ReInitalizeTables()
>> {
>> lock (TableLocker)
>> {
>> Tables_ = new Dictionary<string, string>();
>> Tables_.Add("1", "one");
>> Tables_.Add("2", "two");
>> }
>> }
>> }
>>
>>
>
>I do not think this is possible either. Your example is using a dictionary list. I am using a NameObjectCollectionBase. And, the item I need to lock is at level 2 at the NameObjectCollectionBase object. So, oApp.Tables is where the lock should occur. I really do not know how we can apply a lock at the second level and also with a Get/Set property approach.
(1) Using NameObjectCollectionBase or Dictionary does not matter
(2) A lock on another object ( here TableLocker ) is used to control the access
>So, both suggestions you sent are great but they just do not apply to the current infrastructure I have. It sounded interesting at first, especially the second one. But, while having tried to make the second one work, I realized it might make sense that it just cannot work. Unless I am missing something...
Gregory