Introducing .NET 4.5 (2nd Edition).pdf

(19569 KB) Pobierz
1142523745.032.png 1142523745.033.png 1142523745.034.png 1142523745.035.png 1142523745.001.png
 
 
 
 
 
 
 
 
 
 
 
 
 
1142523745.002.png 1142523745.003.png 1142523745.004.png 1142523745.005.png 1142523745.006.png 1142523745.007.png 1142523745.008.png 1142523745.009.png 1142523745.010.png 1142523745.011.png 1142523745.012.png 1142523745.013.png 1142523745.014.png 1142523745.015.png 1142523745.016.png 1142523745.017.png 1142523745.018.png 1142523745.019.png 1142523745.020.png 1142523745.021.png 1142523745.022.png
 
For your convenience Apress has placed some of the front
matter material after the index. Please use the Bookmarks
and Contents at a Glance links to access them.
1142523745.023.png 1142523745.024.png
Contents at a Glance
About the Authors ................................................................................................ xix
About the Technical Reviewer .............................................................................. xx
Acknowledgments ............................................................................................... xxi
Introduction ........................................................................................................ xxii
Chapter 1: Introduction........................................................................................... 1
Chapter 2: IDE Improvements ................................................................................. 9
Chapter 3: The BCL and the CLR............................................................................ 49
Chapter 4: MEF 2 in 4.5......................................................................................... 81
Chapter 5: Language........................................................................................... 103
Chapter 6: ASP.NET 4.5 ....................................................................................... 123
Chapter 7: ASP.NET MVC 4.................................................................................. 153
Chapter 8: Windows Communication Foundation and Web API.......................... 171
Chapter 9: Working with Data............................................................................. 199
Chapter 10: Windows Azure................................................................................ 215
Chapter 11: Windows Workflow Foundation....................................................... 259
Chapter 12: WPF ................................................................................................. 281
Chapter 13: Silverlight 5 ..................................................................................... 297
Chapter 14: Windows 8 Applications.................................................................. 319
Appendix A: NuGet Introduction.......................................................................... 367
Index ................................................................................................................... 375
1142523745.025.png 1142523745.026.png 1142523745.027.png 1142523745.028.png 1142523745.029.png 1142523745.030.png
C H A P T E R 1
Introduction
Welcome to Introducing .NET 4.5 .
It is my pleasure to be your guide (along with my coauthors) as we take you through the best that
Visual Studio 2012 and .NET 4.5 have to offer, covering everything from Async to WPF (er, well, OK,
maybe not WPF so much).
Aims
About two years ago, I wrote a book ( Introducing .NET 4.0 with Visual Studio 2010 ). This was an
ambitious (and time-consuming!) project where I set out to provide a high-level overview of all the
major changes across the framework from ASP.NET to WCF.
I had some specific ideas in mind when writing the previous book:
This book is about breadth rather than depth. It will get you up-to-speed quickly on
new functionality in just enough depth to get you going but without getting bogged
down with too much detail.
When something big like Visual Studio 2010 is released, I believe developers need and
want an overview of what’s new. When they find an area of interest, they can then
research it further.
When writing it, I tried to keep in mind the following objectives:
Give the reader an introduction to new technologies.
Show how to perform the basics that any developer would want to know.
Produce examples that are as simple as possible but still demonstrate the concept.
Don’t get too bogged down in detail so the book can still be easily read.
The book was well received (although not quite as well as one involving wizarding schoolchildren or
lame-ass vampires) and enjoyed high sells, leading me to believe that there was a need for such a text (if
not, don’t buy it—it only encourages us!). Thus, despite promising myself that I wouldn’t write another
book in a hurry, I find myself writing about the changes in .NET 4.5 and Visual Studio 2012.
This book has the same aims as the previous book. However, I have also made a few changes to
address what I felt were weaknesses of the first text.
1
1142523745.031.png
CHAPTER 1 INTRODUCTION
Changes
Given the breadth of the subject matter, it was impossible to cover all the subject areas in as much detail
as each topic deserved. Some chapters of the first book were much stronger and more in-depth than
others. Sometimes the level of depth reflected the information available, but my own areas of interest
and knowledge also influenced how thoroughly I covered any given topic. So, this time—with the added
bonus of not having to do quite as much work!—I have taken some friends and colleagues along for the
ride. It is my pleasure to introduce you to my fellow authors, Mahesh Krishnan and William Tulloch. I
had the (dubious?) pleasure to work with Mahesh and William at the Australia-based consultancy
Readify ( www.readify.net ). M ahesh specializes in the areas of Azure, WCF, and Silverlight, and he is the
author of Microsoft Silverlight 4 for Dummies . William specializes in WCF and WIF.
Work in Progress!
As I write this, Visual Studio 2012 has yet to be released so it is very likely that there will be last-minute
changes that won’t make it into this book. As we become aware of these changes, we will release
corrections and updates on the Apress web site.
Documentation and examples are also lacking in some areas, which has made researching them
very difficult (particularly the core CLR changes), and some/most of the Microsoft teams were, er, not so
chatty when asked for further information.
What We Will Cover
This book covers the core changes in .NET 4.5 and Visual Studio 2012. We have also included chapters
on current and upcoming technologies included in this release, such as ASP.NET MVC 4, Windows
Azure, and Silverlight 5, which we believe will be of interest to readers.
What We Won’t Cover
We will not be covering some of the great new Team Foundation Server–related changes (these are huge
and would require several books to discuss). We will only be covering the “core” IDE features. We have
also had to make decisions as to which features and changes will be of most interest and/or importance
to our readers so we have had to drop some of the minor changes. Additionally, to save space, examples
are provided in C# only although we have covered changes to VB.NET.
Downloadable Examples
We have tried to keep examples as short as possible to avoid obscuring the concepts we are trying to
demonstrate with plumbing code and also to keep typing to a minimum, but you can obtain a download
of some of the longer sections and examples from my web site at simpleisbest.co.uk/vs2012 .
.NET 4.5 Themes
Every release of .NET and Visual Studio tends to have a core set of themes or improvements. Visual
Studio 2010’s dominant themes, in my opinion, were parallel programming, dynamic types,
extensibility, and bringing C# and VB.NET into line.
So, what are the big themes in .NET 4.5 and Visual Studio 2012?
2
Zgłoś jeśli naruszono regulamin