Author: Andrew Troelsen
Pub Date: 2012
Size: 21 Mb
This new edition of Pro C# 5.0 and the .NET 4.5 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET Framework. You’ll find new chapters covering all the important new features that make .NET 4.5 the most comprehensive release yet, including:
- .NET APIs for Windows 8 style UI apps
- New asynchronous task-based model for async operations
- How HTML5 support is being wrapped into C# web applications
- New programming interfaces for HTTP applications, including improved IPv6 support
- Expanded WPF, WCF and WF libraries giving C# more power than ever before
The relationship between C # and .NET
Throughout this book we emphasize that the C # programming language should be read in conjunction with the platform .NET Framework, and not in isolation. The C # compiler specifically focused on .NET, which means that all the code written in C #, is always carried out only in the environment .NET. It follows two important conclusions with respect to the C # language.
- Architecture and methodology for C # reflect its underlying methodology .NET.
- In many cases, the specific means of C # actually depend on .NET means, i.e. from the base class .NET.
Due to the existence of this relationship before you start programming in C #, you will get some idea of the architecture and methodology of .NET. It is the purpose of this chapter.
- C # – is a programming language designed for .NET, which has the following two important characteristics.
- C # is designed and developed specifically for use with the Microsoft .NET Framework (multifunctional platform development, deployment and execution of distributed applications). C # – language based on modern object-oriented design methodology, the development of which experts from Microsoft relied on the experience of the creation of such languages, constructed in accordance with the proposed about 20 years ago, object-oriented principles.
C # – a full-fledged programming language. Although C #, and is designed to generate code based on the environment .NET, it is not part of .NET. There are a number of funds that are supported by .NET, but not supported by C #, and perhaps you will be surprised that there are also tools that support C # and are not supported by .NET (for example, some cases of overloading).
However, because the C # language is intended for use on the platform .NET, you as a developer, it is important to be aware of the .NET Framework, if you want to build efficient applications in C #. Therefore, in this chapter, we take some time out to look “behind the scenes” .NET.
The common language runtime
The central part of the .NET Framework is its common language runtime, known as the Common Language Runtime (CLR) and .NET runtime. Code executed under the control of CLR, often referred to as managed code.
However, before the code can run CLR, any source code (C # or other languages) must be compiled. Compile in .NET consists of two steps.
- Compile the source code into an intermediate language Microsoft (Intermediate Language – IL).
- Compilation of IL to platform-specific code using the CLR.
This two-step process of compilation is important because the presence of the IL language is the key to the many benefits of .NET.
The intermediate language IL shares with Java byte code idea of a low-level language with a simple syntax (based on numeric and not text codes) that can be quickly translated into an internal machine code. The presence of a well-defined universal syntax for code provides a number of advantages – platform independence, productivity, and interoperability at the level of language.