MSDN Magazine - August 2008 - (Page 19) There are a number of places in the BCL where you can find duplicated functionality. Sometimes the functionality is duplicated within the BCL itself—such is the case with generic collections and non-generic collections. Sometimes the functionality already exists in the base OS, as in the case of globalization support. Not only is it unnecessary to support every alternative in the Silverlight BCL, but we also can provide wins in performance and consistency by eliding this duplicated behavior. Since we introduced support for generic collections in version 2.0 of the .Net Framework, we’ve been advocating that people move to generics. In version 1.x of the runtime, general-purpose data structures had to be based on objects so that the same core data structure class could be used to create collections of different types. With generic-type parameters, the compiler is able to extend these general-purpose data structures to provide type safety, making code easier to write and maintain. Additionally, generic collections generally perform better on value types than non-generic collections because there’s no need to box items. Overall, generics provide all the functionality that non-generic collections provide. And because the duplication is unnecessary, we don’t include nongeneric collections like ArrayList in the Silverlight BCL. Everyone is familiar with at least some of the problems of globalization: many European cultures use a comma as a decimal point; in Chinese numbers are grouped into fours (1000,0000), and so forth. The .NET Framework implements globalization functionality internally so it can work properly in multiple cultures. To do this, it includes globalization data for all supported cultures, allowing .NET–targeted applications to behave consistently across all supported versions of Windows. There are drawbacks, however. The CLR must include large data tables, and the data often becomes stale over time. In addition, the data is Windows-centric, so the data for some .NET cultures is different for the same cultures in Mac OS X. For these reasons, the CoreCLR does not include its own globalization data. Instead, System.Globalization.CultureInfo uses the globalization functionality provided by the host OS. Thus, Silverlight applications will behave more like Mac applications on Mac OS X and like Windows applications on Windows. Overall we’ve tried to maintain a similar API surface area among the CLR, the .NET Compact Framework, and Silverlight, but there are other small differences scattered throughout the BCL. For example, because Silverlight has a single UI thread, it has a single Dispatcher object that holds a queue of work items for the UI. Using the Dispatcher will allow you to update the UI from a non-UI thread. This code will allow you to update a UI element— MyListBox—with a collection created on another thread (say, from a background thread): MyListBox.Dispatcher.BeginInvoke(() => MyListBox.ItemsSource = MyItems); Framework releases. A good example of this is isolated storage, which provides a virtualized file system to sandboxed applications. It’s been around since the .NET Framework 1.0, but it has always We introduced support for generic collections in Silverlight 2. addressed limited scenarios. Silverlight focuses on sandboxed applications and thus can make full use of isolated storage: using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (StreamWriter writer = new StreamWriter(isoStore)) { writer.Write(“This is an isolated storage file.”); } } Like cookies in a Web browser, isolated storage allows Silverlight applications to maintain state across invocations. However, isolated storage offers a full virtualized file system that supports creation of directories and files. Although isolated storage is not intended for storage of high-value data such as passwords, the storage loca- We recommend using System.ComponentModel.BackgroundWorker in Silverlight because it encapsulates the updating of the UI on completion, but for compatibility we still include low-level threading APIs such as System.Threading.ThreadPool.QueueUserWorkItem and System.Threading.Monitor.Enter. Like the Security Transparency model, some functionality that is new in the Silverlight BCL actually appeared in previous .NET msdnmagazine.com August 2008 19 http://microsoft.net http://www.ektron.com/msdn http://microsoft.net http://msdnmagazine.com
Table of Contents Feed for the Digital Edition of MSDN Magazine - August 2008 MSDN Magazine - August 2008 Toolbox CLR Inside Out Basic Instincts Cutting Edge Patterns in Practice Data 2.0 - Expose And Consume Data In A Web Services World Biztalk EDI - Build A Robust EDI Solution With BizTalk Server Silverlight - Create Animations With XAML And Expression Blend Write On! - Create Web Apps You Can Draw On With Silverlight 2 Wicked Code - Craft Custom Controls For Silverlight 2 Team System Foundations Windows With C++ Concurrent Affairs Going Places { End Bracket } MSDN Magazine - August 2008 MSDN Magazine - August 2008 - (Page Intro) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page Cover1) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page Cover2) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 1) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 2) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 3) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 4) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 5) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 6) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 7) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 8) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 9) MSDN Magazine - August 2008 - MSDN Magazine - August 2008 (Page 10) MSDN Magazine - August 2008 - Toolbox (Page 11) MSDN Magazine - August 2008 - Toolbox (Page 12) MSDN Magazine - August 2008 - Toolbox (Page 13) MSDN Magazine - August 2008 - Toolbox (Page 14) MSDN Magazine - August 2008 - Toolbox (Page 15) MSDN Magazine - August 2008 - Toolbox (Page 16) MSDN Magazine - August 2008 - CLR Inside Out (Page 17) MSDN Magazine - August 2008 - CLR Inside Out (Page 18) MSDN Magazine - August 2008 - CLR Inside Out (Page 19) MSDN Magazine - August 2008 - CLR Inside Out (Page 20) MSDN Magazine - August 2008 - CLR Inside Out (Page 21) MSDN Magazine - August 2008 - CLR Inside Out (Page 22) MSDN Magazine - August 2008 - Basic Instincts (Page 23) MSDN Magazine - August 2008 - Basic Instincts (Page 24) MSDN Magazine - August 2008 - Basic Instincts (Page 25) MSDN Magazine - August 2008 - Basic Instincts (Page 26) MSDN Magazine - August 2008 - Basic Instincts (Page 27) MSDN Magazine - August 2008 - Basic Instincts (Page 28) MSDN Magazine - August 2008 - Basic Instincts (Page 29) MSDN Magazine - August 2008 - Basic Instincts (Page 30) MSDN Magazine - August 2008 - Basic Instincts (Page 31) MSDN Magazine - August 2008 - Basic Instincts (Page 32) MSDN Magazine - August 2008 - Cutting Edge (Page 33) MSDN Magazine - August 2008 - Cutting Edge (Page 34) MSDN Magazine - August 2008 - Cutting Edge (Page 35) MSDN Magazine - August 2008 - Cutting Edge (Page 36) MSDN Magazine - August 2008 - Cutting Edge (Page 37) MSDN Magazine - August 2008 - Cutting Edge (Page 38) MSDN Magazine - August 2008 - Patterns in Practice (Page 39) MSDN Magazine - August 2008 - Patterns in Practice (Page 40) MSDN Magazine - August 2008 - Patterns in Practice (Page 41) MSDN Magazine - August 2008 - Patterns in Practice (Page 42) MSDN Magazine - August 2008 - Patterns in Practice (Page 43) MSDN Magazine - August 2008 - Patterns in Practice (Page 44) MSDN Magazine - August 2008 - Patterns in Practice (Page 45) MSDN Magazine - August 2008 - Patterns in Practice (Page 46) MSDN Magazine - August 2008 - Patterns in Practice (Page 47) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 48) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 49) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 50) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 51) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 52) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 53) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 54) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 55) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 56) MSDN Magazine - August 2008 - Data 2.0 - Expose And Consume Data In A Web Services World (Page 57) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 58) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 59) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 60) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 61) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 62) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 63) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 64) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 65) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 66) MSDN Magazine - August 2008 - Biztalk EDI - Build A Robust EDI Solution With BizTalk Server (Page 67) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 68) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 69) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 70) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 71) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 72) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 73) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 74) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 75) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 76) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 77) MSDN Magazine - August 2008 - Silverlight - Create Animations With XAML And Expression Blend (Page 78) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 79) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 80) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 81) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 82) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 83) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 84) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 85) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 86) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 87) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 88) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 89) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 90) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 91) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 92) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 93) MSDN Magazine - August 2008 - Write On! - Create Web Apps You Can Draw On With Silverlight 2 (Page 94) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 95) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 96) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 97) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 98) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 99) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 100) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 101) MSDN Magazine - August 2008 - Wicked Code - Craft Custom Controls For Silverlight 2 (Page 102) MSDN Magazine - August 2008 - Team System (Page 103) MSDN Magazine - August 2008 - Team System (Page 104) MSDN Magazine - August 2008 - Team System (Page 105) MSDN Magazine - August 2008 - Team System (Page 106) MSDN Magazine - August 2008 - Team System (Page 107) MSDN Magazine - August 2008 - Team System (Page 108) MSDN Magazine - August 2008 - Foundations (Page 109) MSDN Magazine - August 2008 - Foundations (Page 110) MSDN Magazine - August 2008 - Foundations (Page 111) MSDN Magazine - August 2008 - Foundations (Page 112) MSDN Magazine - August 2008 - Foundations (Page 113) MSDN Magazine - August 2008 - Foundations (Page 114) MSDN Magazine - August 2008 - Windows With C++ (Page 115) MSDN Magazine - August 2008 - Windows With C++ (Page 116) MSDN Magazine - August 2008 - Windows With C++ (Page 117) MSDN Magazine - August 2008 - Windows With C++ (Page 118) MSDN Magazine - August 2008 - Windows With C++ (Page 119) MSDN Magazine - August 2008 - Windows With C++ (Page 120) MSDN Magazine - August 2008 - Windows With C++ (Page 121) MSDN Magazine - August 2008 - Windows With C++ (Page 122) MSDN Magazine - August 2008 - Concurrent Affairs (Page 123) MSDN Magazine - August 2008 - Concurrent Affairs (Page 124) MSDN Magazine - August 2008 - Concurrent Affairs (Page 125) MSDN Magazine - August 2008 - Concurrent Affairs (Page 126) MSDN Magazine - August 2008 - Concurrent Affairs (Page 127) MSDN Magazine - August 2008 - Concurrent Affairs (Page 128) MSDN Magazine - August 2008 - Concurrent Affairs (Page 129) MSDN Magazine - August 2008 - Concurrent Affairs (Page 130) MSDN Magazine - August 2008 - Going Places (Page 131) MSDN Magazine - August 2008 - Going Places (Page 132) MSDN Magazine - August 2008 - Going Places (Page 133) MSDN Magazine - August 2008 - Going Places (Page 134) MSDN Magazine - August 2008 - Going Places (Page 135) MSDN Magazine - August 2008 - { End Bracket } (Page 136) MSDN Magazine - August 2008 - { End Bracket } (Page Cover3) MSDN Magazine - August 2008 - { End Bracket } (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.