During my CLR/BCL/C# 4.0 talk, a few people asked me questions for which I didn’t have the answer. I have now researched these questions and have the answers.
Question #1: Are the new concurrent collection classes in .NET 4.0 serializable?
Answer: Yes, ConcurrentStack, ConcurrentQueue, ConcurrentBag, and ConcurrentDictionary are all serializable. However, the BlockingCollection class (which can wrap any of these except for ConcurrentDictionary) is not serializable.
Question #2: How do you set multiple fallback languages with the ResourceManager class in Silverlight and in .NET 4.0?
Answer: The ResourceManager calculates the full fallback sequence as follows:
1. Requested culture (argument to GetString or GetObject), if provided, or current thread UICulture (let’s call this C1) – as of .NET 4.0, only one culture can be specified this way.
2. C1’s parent; repeat up parent chain but stop before invariant culture
3. Cultures returned by the Win32 GetThreadPreferredUILanguages (passing the MUI_MERGE_USER_FALLBACK | MUI_MERGE_SYSTEM_FALLBACK flags), removing duplicates from 1 & 2 – this is the new addition in Silverlight & .NET 4.
4. Invariant culture