Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780735668010-files/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Introduction
Microsoft Visual C# is a powerful but simple language aimed primarily at developers creating applications by using the Microsoft .NET Framework. It inherits many of the best features of C++ and Microsoft Visual Basic, but few of the inconsistencies and anachronisms, resulting in a cleaner and more logical language. C# 1.0 made its public debut in 2001. The advent of C# 2.0 with Visual Studio 2005 saw several important new features added to the language, including generics, iterators, and anonymous methods. C# 3.0, which was released with Visual Studio 2008, added extension methods, lambda expressions, and most famously of all, the Language-Integrated Query facility, or LINQ. C# 4.0, released in 2010, provided further enhancements that improved its interoperability with other languages and technologies. These features included support for named and optional arguments, and the dynamic type, which indicates that the language runtime should implement late binding for an object. An important addition in the .NET Framework released concurrently with C# 4.0 was the classes and types that constitute the Task Parallel Library (TPL). Using the TPL, you can build highly scalable applications that can take full advantage of multicore processors quickly and easily. C# 5.0 adds native support for asynchronous task-based processing through the async method modifier and the await operator.
Another key event for Microsoft has been the launch of Windows 8. This new version of Windows supports highly interactive applications that can share data and collaborate with each other as well as connect to services running in the cloud. The development environment provided by Microsoft Visual Studio 2012 makes all these powerful features easy to use, and the many new wizards and enhancements included in Visual Studio 2012 can greatly improve your productivity as a developer. The combination of Visual Studio 2012, Windows 8, and C# 5.0 provides a comprehensive platform and toolset for building the next generation of powerful, intuitive, and portable applications. However, even if you are not using Windows 8, Visual Studio 2012 and C# 5.0 have much to offer, and they form an invaluable partnership for helping you to build great solutions.
Who Should Read This Book
This book assumes that you are a developer who wants to learn the fundamentals of programming with C# by using Visual Studio 2012 and the .NET Framework version 4.5. By the time you complete this book, you will have a thorough understanding of C# and will have used it to build responsive and scalable Windows Presentation Foundation (WPF) applications that can run on both Windows 7 and Windows 8.
You can build and run C# 5.0 applications on Windows 7 and Windows 8, although the user interfaces provided by these two operating systems have some significant differences. Consequently, focuses on the application development model used by Windows 8, and the material in this section provides an introduction to building interactive applications for this new platform.
Who Should Not Read This Book
This book is aimed at developers new to C#, and as such, it concentrates primarily on the C# language. This book is not intended to provide detailed coverage of the multitude of technologies available for building enterprise-level applications for Windows, such as ADO.NET, ASP.NET, Windows Communication Foundation, or Workflow Foundation. If you require more information on any of these items, you might consider reading some of the other titles in the Step by Step for Developers series available from Microsoft Press, such as Microsoft ASP.NET 4 Step by Step, Microsoft ADO.NET 4 Step by Step, and Microsoft Windows Communication Foundation 4 Step by Step .
Organization of This Book
This book is divided into four sections:
provides an introduction to the core syntax of the C# language and the Visual Studio programming environment.
goes into detail on how to create and manage new types by using C#, and how to manage the resources referenced by these types.
, includes extended coverage of the elements that C# provides for building types that you can reuse across multiple applications.
, describes the Windows 8 programming model, and how you can use C# to build interactive applications for this new model.
Note
Although are applicable to Windows 7 applications.
Finding Your Best Starting Point in This Book
This book is designed to help you build skills in a number of essential areas. You can use this book if you are new to programming or if you are switching from another programming language such as C, C++, Java, or Visual Basic. Use the following table to find your best starting point.
If you are | Follow these steps |
---|
New to object-oriented programming | Install the practice files as described in the upcoming section, . Work through the chapters in sequentially. Complete as your level of experience and interest dictates.
|
Familiar with procedural programming languages such as C but new to C# | Install the practice files as described in the upcoming section, . Complete as your level of experience and interest dictates.
|
Migrating from an object-oriented language such as C++ or Java | Install the practice files as described in the upcoming section, . Skim the first seven chapters to get an overview of C# and Visual Studio 2012, and then concentrate on . For information about building scalable Windows 8 applications, read .
|
Switching from Visual Basic 6 to C# | Install the practice files as described in the upcoming section, .
|