![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Serialization of Dictionary<> and Thread Synch Hi I may be being stupid here (as I haven't tried it yet) but if I have WCF Service which returns a static Dictionary<K,V> object (which I understand is serializable in WCF) and another thread were to modify that collection while it were serializing, what would happen? Does the framework take care of it (e.g. snapshot the collection), or would I need to synchronize the addition/removal of Dictionary objects with the service that returns the Dictionary to calling clients? Thanks |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: Serialization of Dictionary<> and Thread Synch In such cases I don't take a chance and copy object ( Dictionary in your case ) under Sync object ( Lock()/Monitor()... ) before return copied object from service, so I'm calm that object will be returned to client without changes Arkady "Jon" <Jon@discussions.microsoft.com> wrote in message news:48244107-16D2-406E-BCA5-02A117E3038E@microsoft.com... > Hi > > I may be being stupid here (as I haven't tried it yet) but if I have WCF > Service which returns a static Dictionary<K,V> object (which I understand > is > serializable in WCF) and another thread were to modify that collection > while > it were serializing, what would happen? > > Does the framework take care of it (e.g. snapshot the collection), or > would > I need to synchronize the addition/removal of Dictionary objects with the > service that returns the Dictionary to calling clients? > > Thanks |
My System Specs![]() |
| | #3 (permalink) |
| Guest | Re: Serialization of Dictionary<> and Thread Synch If the serialization process use an enumerator on the dictionnary while it serialize... The dictionnary.add method will crash, doesn't it ? "Arkady Frenkel" <arkadyf@hotmailxdotx.com> a écrit dans le message de news: uC5PLtF%23GHA.4468@TK2MSFTNGP05.phx.gbl... > In such cases I don't take a chance and copy object ( Dictionary in your > case ) under Sync object ( Lock()/Monitor()... ) > before return copied object from service, so I'm calm that object will be > returned to client without changes > > Arkady > > "Jon" <Jon@discussions.microsoft.com> wrote in message > news:48244107-16D2-406E-BCA5-02A117E3038E@microsoft.com... >> Hi >> >> I may be being stupid here (as I haven't tried it yet) but if I have WCF >> Service which returns a static Dictionary<K,V> object (which I understand >> is >> serializable in WCF) and another thread were to modify that collection >> while >> it were serializing, what would happen? >> >> Does the framework take care of it (e.g. snapshot the collection), or >> would >> I need to synchronize the addition/removal of Dictionary objects with the >> service that returns the Dictionary to calling clients? >> >> Thanks > > |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Start a new thread from an existing thread, which was started from atimer | Curious | .NET General | 1 | 06-13-2008 01:36 PM |
| XML Serialization | Tom | .NET General | 5 | 04-16-2008 02:30 PM |
| Dictionary<TKey,TValue> as a Dictionary key in C# 2.0 | dox | .NET General | 5 | 03-19-2008 09:15 AM |