Dot Net Framework
Total Page:16
File Type:pdf, Size:1020Kb
Government Polytechnic Srinagar Garhwal Branch-Information Technology Semester-6 Subject- .NET Technology Unit-1 Introduction to .NET Framework Course Description: Introduction to .NET Framework, Components and Features. Course Duration: 08 hours Course Goals and Objectives: After completing this course, trainee will be able to understand the fundamentals of .NET Framework, Components like JIT Compilation, CTS, CLR, MSIL and CLS. NET Framework NET Framework is a technology that supports building and running Windows apps, Web Apps, Remoting and web services. .NET is a developer platform made up of tools, programming languages, and libraries for building many different types of applications. .NET Framework consists of the common language runtime (CLR) and the .NET Framework class library. .NET Framework is designed to fulfil the following objectives: 1. To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but web-distributed or executed remotely. 2. To provide a code-execution environment that minimizes software deployment and versioning conflicts. 3. To provide a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party. 4. To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. 5. To make the developer experience consistent across widely varying types of apps, such as Windows-based apps and Web-based apps. 6. To build all communication on industry standards to ensure that code based on .NET Framework integrates with any other code. You can use .NET Framework to develop the following types of apps and services: 1. Console apps. 2. Windows GUI apps. 3. Windows Presentation Foundation (WPF) apps. 4. ASP.NET Web apps. 5. Windows services. 6. Web Services Government Polytechnic Srinagar Garhwal Branch-Information Technology Semester-6 Subject- .NET Technology Unit-1 Introduction to .NET Framework 7. Remoting Services. 8. WCF (Windows Communication Foundation) Services. 9. ASP.NET Web API (REST Services). 10. Machine Learning App (ML .NET). Components of .NET Framework 1. CLR (Common Language Runtime) a. CTS (Common Type System) b. CLS (Common Language Specification) c. JIT (Just In Time) Compiler d. MSIL (Microsoft Intermediate Language) 2. Framework Class Library Languages Supported by .NET Framework 1. C#.NET 2. VB.NET 3. C++.NET 4. J#.NET 5. F#.NET 6. JSCRIPT.NET 7. IRON RUBY 8. IRON PYTHON CLR (Common Language Runtime) The common language runtime is the foundation of .NET Framework. CLR is an agent that manages code at execution time, providing core services such as memory management, thread management, and remoting, while also enforcing strict type safety and other forms of code accuracy that promote security and robustness. The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system services. These features are intrinsic to the managed code that runs on the common language runtime. The runtime also enforces code robustness by implementing a strict type- and-code-verification infrastructure called the common type system (CTS). The runtime is designed to enhance performance. Although the common language runtime provides many standard runtime services, managed code is never interpreted. Features of the Common Language Runtime Government Polytechnic Srinagar Garhwal Branch-Information Technology Semester-6 Subject- .NET Technology Unit-1 Introduction to .NET Framework 1. Memory Management. 2. Code Access security. 3. Garbage Collection. 4. JIT Compilation. 5. Thread Support. 6. Debug Engine. 7. Exception Handling. 8. Code robustness. 9. Enhance Performance NET Framework class library The class library is a comprehensive, object-oriented collection of reusable types that you use to develop apps ranging from traditional command-line or graphical user interface (GUI) apps to apps based on the latest innovations provided by ASP.NET, such as Web Forms and XML web services. The .NET Framework class library is a collection of reusable types that tightly integrate with the common language runtime. The class library is object oriented, providing types from which your own managed code derives functionality. This not only makes the .NET Framework types easy to use but also reduces the time associated with learning new features of the .NET Framework. In addition, third-party components integrate seamlessly with classes in the .NET Framework. Features of .NET Framework 1. Rich Functionality. 2. Easy development of web applications. 3. OOPs Support. 4. Multi-Language Support. 5. Automatic memory management. 6. Compatibility with COM and COM+. 7. Strong XML and JSON support. 8. Ease of deployment and configuration. 9. Security. MSIL (Microsoft Intermediate Language) Microsoft intermediate language (MSIL) is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be run, MSIL must be converted to CPU-specific code, usually by a Government Polytechnic Srinagar Garhwal Branch-Information Technology Semester-6 Subject- .NET Technology Unit-1 Introduction to .NET Framework just-in-time (JIT) compiler. Because the common language runtime (CLR) supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture. Before you can run Microsoft intermediate language (MSIL), it must be compiled against the common language runtime to native code for the target machine architecture. The .NET Framework provides two ways to perform this conversion: 1. A .NET Framework just-in-time (JIT) compiler. 2. The .NET Framework Ngen.exe (Native Image Generator). Compilation by the JIT Compiler JIT compilation converts MSIL to native code on demand at application run time, when the contents of an assembly are loaded and executed. Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can build a set of MSIL assemblies that can be JIT-compiled and run on different computers with different machine architectures. However, if your managed code calls platform-specific native APIs or a platform-specific class library, it will run only on that operating system. Just-in-time (JIT) compiling enables all managed code to run in the native machine language of the system on which it's executing. Meanwhile, the memory manager removes the possibilities of fragmented memory and increases memory locality-of-reference to further increase performance. (CLS) Common Language Specification To enable full interoperability scenarios, all objects that are created in code must rely on some commonality in the languages that are consuming them (are their callers). Since there are numerous different languages, .NET has specified those commonalities in something called the Common Language Specification (CLS). CLS defines a set of features that are needed by many common applications. It also provides a sort of recipe for any language that is implemented on top of .NET on what it needs to support. CLS is a subset of the CTS. This means that all of the rules in the CTS also apply to the CLS, unless the CLS rules are more strict. If a component is built using only the rules in the CLS, that is, it exposes only the CLS features in its API, it is said to be CLS-compliant. CTS (Common Type System) Government Polytechnic Srinagar Garhwal Branch-Information Technology Semester-6 Subject- .NET Technology Unit-1 Introduction to .NET Framework The common type system defines how types are declared, used, and managed in the common language runtime, and is also an important part of the runtime's support for cross-language integration. The CTS ensures that all managed code is self-describing. The various Microsoft and third-party language compilers generate managed code that conforms to the CTS. The common type system performs the following functions: 1. Establish a framework for cross-language execution. 2. Provide an object-oriented model to support implementing various languages on a .NET implementation. 3. Define a set of rules that all languages must follow when it comes to working with types. 4. Provide a library that contains the basic primitive types that are used in application development (such as, Boolean, Byte, Char etc.) 5. Establishes a framework that helps enable cross-language integration, type safety, and high-performance code execution. 6. Provides an object-oriented model that supports the complete implementation of many programming languages. 7. Defines rules that languages must follow, which helps ensure that objects written in different languages can interact with each other. 8. Provides a library that contains the primitive data types (such as Boolean, Byte, Char, Int32, and UInt64) used in application development. Types in .NET All types in .NET are either value types or reference types. Value types are data types whose objects are represented by the object's actual value. If an instance of a value type is assigned to a variable, that variable is given a fresh copy of the value. Reference types are data types whose objects are represented by a reference (similar to a pointer) to the object's actual value. If a reference type is assigned to a variable, that variable references (points to) the original value. No copy is made. The common type system in .NET supports the following five categories of types: 1. Classes 2. Structures 3. Enumerations 4. Interfaces 5. Delegates .