20 CHAPTER 1 THE PHILOSOPHY OF .NET (Hp web site)
20 CHAPTER 1 THE PHILOSOPHY OF .NET However, if you were to simply make use of unsigned data internally as follows: public class Calc { public int Add(int x, int y) { // As this ulong variable is only used internally, // we are still CLS compliant. ulong temp; … return x + y; } } you have still conformed to the rules of the CLS, and can rest assured that all .NET languages are able to invoke the Add() method. Of course, in addition to Rule 1, the CLS defines numerous other rules. For example, the CLS describes how a given language must represent text strings, how enumerations should be represented internally (the base type used for storage), how to define static members, and so forth. Luckily, you don t have to commit these rules to memory to be a proficient .NET developer. Again, by and large, an intimate understanding of the CTS and CLS specifications is only of interest to tool/compiler builders. Ensuring CLS Compliance As you will see over the course of this book, C# does define a number of programming constructs that are not CLS-compliant. The good news, however, is that you can instruct the C# compiler to check your code for CLS compliance using a single .NET attribute: // Tell the C# compiler to check for CLS compliance. [assembly: System.CLSCompliant(true)] Chapter 12 dives into the details of attribute-based programming. Until then, simply understand that the [CLSCompliant] attribute will instruct the C# compiler to check each and every line of code against the rules of the CLS. If any CLS violations are discovered, you receive a compiler error and a description of the offending code. Understanding the Common Language Runtime In addition to the CTS and CLS specifications, the final TLA (three letter abbreviation) to contend with at the moment is the CLR. Programmatically speaking, the term runtime can be understood as a collection of external services that are required to execute a given compiled unit of code. For example, when developers make use of the Microsoft Foundation Classes (MFC) to create a new application, they are aware that their program requires the MFC runtime library (i.e., mfc42.dll). Other popular languages also have a corresponding runtime. VB6 programmers are also tied to a runtime module or two (e.g., msvbvm60.dll). Java developers are tied to the Java Virtual Machine (JVM) and so forth. The .NET platform offers yet another runtime system. The key difference between the .NET runtime and the various other runtimes I just mentioned is the fact that the .NET runtime provides a single well-defined runtime layer that is shared by all languages and platforms that are .NET-aware. The crux of the CLR is physically represented by a library named mscoree.dll (aka the Common Object Runtime Execution Engine). When an assembly is referenced for use, mscoree.dll is loaded automatically, which in turn loads the required assembly into memory. The runtime engine is responsible for a number of tasks. First and foremost, it is the entity in charge of resolving
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.