Tuesday, November 19, 2019

C# : Unit 1 for .NET Framework & Visual Studio IDE and Language Basics for IT Students


--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD-IT)
E-Mail : rupareleducation@gmail.com
Contact No : 7600044051

.NET Framework & Visual Studio IDE, Language Basics 


Q.1    Introduction to .net Framework
·        The .net framework is a service or platform for building deploying and running application
·        .new framework consist two main part that is
Ø Common Language Run time
Ø Class Library
·        Common Language run time is the execution engine fro .net frame work application
·        It is the heart and backbone or the .net application.
·        It is the runtime engine provided by the .net framework.
·        It provide infrastructure for running a program and also allow them to communicate with others parts of the .net framework.
·        It provide a number of services like
Ø Code loading and execution.
Ø Application memory isolation.
Ø Verification of the type safe.
Ø Conversion to intermediate language to native code.
Ø Allow to access metadata [Data about database]
Ø Manage Memory and Manage Object
Ø Exception handling.
·        Following is a Diagram for .net framework
Ø Draw Diagram
·        Common Type System allow program written in a different programming language to share information.
·        A class is a written in C# should be equivalent to the class written in V.B. .net
·        Common Type System Provide Cross Language integration.
·        Common Type System support two different categories.
Ø Value Type.
Ø Reference Type
·        Common Language Specification include basic language features needed by almost all the application.
·        It serve as a guide for library and the compiler.
·        There is one another concept for assembly and it’s a primary building block of .net framework application.
·        It can be either DLL or EXE.
·        It consist number of DLL files or Executable files.
·        Metadata is also store within assembly.
·        .net record information about compile class as a metadata.
·        Metadata means data about database.
·        .net language compiled will Generate metadata & Store this in the assembly.
Metadata is nothing but description of every name space class, method, property etc.


Advantages of .NET
Here are some of the compelling advantages of .NET:
·  Object Oriented
Everything that you see in the .NET framework is an object. It is the same for what you write within the framework. This means that you get a powerful tool to not just access but also control your apps. This also makes it simpler for you to respond to recurring events.
·  Caching
The caching system that .NET includes is extremely robust and easy-to-use.
·  Easy Maintenance
Pages, with .NET, are extremely simple to write and maintain. This is because the source code and HTML are both together. In addition to that, the source code executes on the server. What does this mean? This makes your web pages more powerful and flexible.
·  Time-Saving
Time is money, and .NET helps you save a lot of that. The way it is developed, .NET removes a large part of the coding requirement. This means that the developers save time, and the app’s time-to-market can be shortened considerably.
·  Simplicity
Performing common tasks with .NET is extremely simple and straight forward. Submission of forms is a breeze and so is site configuration, deployment, and client authentication.
·  Feature-Rich
There are a range of features that can be explored by the developers in order to create powerful apps. Consider the case of its rich toolbox as also the designer in the visual studio. They let you access such features as automatic deployment, WYSIWYG editing, and drag-and-drop controls.
·  Consistency
The management and monitoring of all the processes is performed by the framework. If one of the processes is dead, a new process can be created just as easily. This lets your app be consistently available for handling requests.
·  Monitoring
Finally, .NET also stands for its automatic monitoring. It will promptly notice any problems like infinite loops, memory leaks, etc. Not just this, it will also destroy these activities automatically and restart itself.
In conclusion, there are tons of advantages that .NET offers. These features make it popular among clients as well as programmers.
Disadvantages of .NET
Along with advantages, you will always come across disadvantages of any platform. That’s the case with .NET too.
Here’s a compilation of some of the drawbacks of using .NET:
·  Limited Object Relational (OR) support
It is found to be limited at times, because such support is generally available with entity framework only.
·  Slower than Native Code
Managed code that you run with .NET can be slower than native code.
·  Vendor lock-in
The framework involves Vendor lock-in. This can mean that future development will be only dependent on Microsoft.
·  Expensive
In some cases, migration of apps to .NET can turn out to be expensive.
However, these are all just minor draw-backs when compared to the large range of advantages offered by the framework.


What is CLR?
The Common Language Runtime is the execution engine for .NET Framework applications.
CLR (Common Language Runtime) is a heart of Dot Net Framework. The core function of dot.net framework to execute application and to convert Managed code to native code.
It provides a number of services, including the following:
1. Code management (loading and execution)
2. Application memory isolation.
3. Verification of type safety
4. Conversion of IL to native code using JIT
5. Access to metadata (enhanced type information)
6. Managing memory for managed objects (garbage collection).
7. Enforcement of code access security (CAS)
8. Exception handling, including cross-language exceptions
9. Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data)
10. Automation of object layout

11. Support for developer services (profiling, debugging).

What is CTS ?

Common Type System allows two different languages of dot.net (C#, VB.NET) will get compiled into common base type for smooth communication..CTS is handled by the CLR.
The common type system supports two general categories of types: 

Value types:
Value types directly contain their data, and instances of value types are either allocated on the stack or allocated inline in a structure. Value types can be built-in (implemented by the runtime), user-defined, or enumerations.

Reference types:
Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates. 

What is CLS? 

CLS stands for Common Language Specification and it is a subset of CTS. It defines a set of rules and restrictions that every language must follow which runs under .NET framework. The languages which follows these set of rules are said to be CLS Compliant. In simple words, CLS enables cross-language integration.

For example, one rule is that you cannot use multiple inheritance within .NET Framework. As you know C++ supports multiple inheritance but; when you will try to use that C++ code within C#, it is not possible because C# doesn’t supports multiple inheritance.

One another rule is that you cannot have members with same name with case difference only i.e. you cannot have add() and Add() methods. This easily works in C# because it is case-sensitive but when you will try to use that C# code in VB.NET, it is not possible because VB.NET is not case-sensitive.

What is BCL?


BCL stands for Base class library also known as Class library (CL). BCL is a subset of Framework class library (FCL). Class library is the collection of reusable types that are closely integrated with CLR. Base Class library provides classes and types that are helpful in performing day to day operation e.g. dealing with string and primitive types, database connection, IO operations.
while Framework class library contains thousands of classes used to build different types of applications and provides all the basic functionalities and services that application needs. FCL includes classes and services to support different variety of application e.g.
·         Desktop application,
·         Web application (ASP.Net, MVC, WCF),
·         Mobile application,
·         Xbox application,
·         Windows Service etc.

What is FCL?

.NET Framework Class Library is the collection of classes, namespaces, interfaces 
and value types that are used for .NET applications.
It contains thousands of classes that supports the following functions.
·        Base and user-defined data types
·        Support for exceptions handling
·        input/output and stream operations
·        Communications with the underlying system
·        Access to data
·        Ability to create Windows-based GUI applications
·        Ability to create web-client and server applications
·        Support for creating web services

.NET Base Class Library is the sub part of the Framework that provides library 
support to Common Language Runtime to work properly. It includes the System 
namespace and core types of the .NET framework.

What is Namespace?

Namespaces are used to organize the classes. It helps to control the scope of 
methods and classes in larger .Net programming projects.

In simpler words you can say that it provides a way to keep one set of names 
like class names, different from other sets of names.

namespace is designed for providing a way to keep one set of names separate from another. The 
class names declared in one namespace does not conflict with the same class names declared in 
another.

The biggest advantage of using namespace is that the class names which are 
declared in one namespace will not clash with the same class names declared in 
another namespace.

It is also referred as named group of classes having common features.

The members of a namespace can be namespaces, interfaces, structures, and delegates.

What is Assembly?

Microsoft .Net Assembly is a logical unit of code, that contains code which 
the Command Language Runtime (CLR) executes.

It is the smallest unit of deployment of a .net application and it can be a .dll or 
an exe.

Assembly is really a collection of types and resource information that are built 
to work together and form a logical unit of functionality.

It includes both executable application files that you can run directly from 
Windows without the need for any other programs .exe files, and libraries .dll 
files for use by other applications.

Assemblies are the building blocks of .NET Framework applications.

During the compile time Metadata is created with Microsoft Intermediate 
Language (MSIL) and stored in a file called Assembly Manifest.

Both Metadata and Microsoft Intermediate Language (MSIL) together wrapped 
in a Portable Executable (PE) file.

Assembly Manifest contains information about itself. 

This information is called Assembly Manifest, it contains information about the 
members, types, references and all the other data that the runtime needs for 
execution.


What is Meta Data?

Metadata in .Net is binary information which describes the characteristics of a 
resource.

This information include Description of the Assembly , Data Types and 
members with their declarations and implementations, references to other types 
and members , Security permissions etc.

A module's metadata contains everything that needed to interact with another 
module.

During the compile time Metadata created with Microsoft Intermediate 
Language (MSIL) and stored in a file called a Manifest.

Both Metadata and Microsoft Intermediate Language (MSIL) together wrapped 
in a Portable Executable (PE) file.

During the runtime of a program Just In Time (JIT) compiler of the Common 
Language Runtime (CLR) uses the Metadata and converts Microsoft 

Intermediate Language (MSIL) into native code.

When code is executed, the runtime loads metadata into memory and references 
it to discover information about your code's classes, members, inheritance, and 
so on.

Moreover Metadata eliminating the need for Interface Definition Language 
(IDL) files, header files, or any external method of component reference.



Please share and comment it... Thank you.

:: Best of Luck ::

https://myshopprime.com/uday.shah3/shop