Sunday, September 9, 2018

The .NET Framework Architecture


Common Language Specification (CLS)
Enables cross-language interoperability
Common Language Specification describes interoperability requirements
Inside CLS common type system (CTS) describe how different data types for the same constant should work together.
For example char array in C++ and Strings in C# can be used as sequence of alphabets.
CLS is what the languages must provide in order to work in the .NET Word.
This Specification is public so any one can write a language to work with .NET frame work but first to complete the CLS.
Over 15 languages  are  supported today by .Net.
C#, VB, Jscript, Visual C++ are from Microsoft, but there are  some other languages  also that use the same set of services as they came with CLS.
NET Classes (4 Areas)
ASP.NET:
ASP.NET provides the core Web infrastructure such as Web Forms development and Web Services.
Windows Forms:
User interface development on the Windows platform can be done using Windows Forms
ADO.NET:
Provide the means (functions, classes and so on..) for  data access.
Base Class Library:
Finally, the core base classes library (BCL) contains namespaces that group classes into common blocks of functionality for common and frequent use.
For example all the classes deals with files are in one namespace
Common Language Runtime (CLR)
CLR provide common runtime Environment for all .NET languages.
CLR purpose is to run and load Application compiled to Microsoft Intermediate Language (MSIL) or IL in short.
CLR manages basic services of .NET such as:
Memory management
Garbage collection
Exception Handling
Loading/Running Applications
CLR with Managed and Un-Managed code
CLR allow the applications to run the managed and unmanaged code.
Unmanaged code runs out side the CLR.
For example VB6/C++ code compiled w/o .NET
Managed code runs within the CLR and get benefits of the CLR  features( Memory management, Garbage Collection and So on).









NET Framework Base Class Library

BCL consists of classes that provide base functionality for .NET Framework
And many classes that make your life as developer easier
Library of classes used by all .NET applications
Contains large number of classes (Block of functionality, properties and events) grouped into namespaces
Each class within namespace has a unique name.
BCL’s namespaces group classes into common blocks of functionality.
For example all the classes deals with files are in one namespace i.e. System.IO
Some BCL namespaces…
System
That includes the basic data types like integer, string, time, Boolean and so on.
Some console and input/output, garbage collection and memory management functions.
System.Data
Including the classes dealing with data including ODBC, SQL server, data sources and so on.
System.IO
Have functionality about working with streams and disks i.e. moving data from one place to an other.
System.Text
Dealing about string and texts. Converts data from block of bytes to texts and so on.
System.Text.RegularExpresions
Providing some magic of string operations and matching of data.
System.Web
Provide design and run time support for web application.
System.Windows.Forms
Provides the support for using and designing the windows application and its controls.
System.Text.RegularExpresions
Providing some magic of string operations and matching of data.
System.Web
Provide design and run time support for web application.
System.Windows.Forms
Provides the support for using and designing the windows application and its controls.
System.Collections.Generic
Deals with the safe-type-caste provide conversion between data values.
If different names for the same data type are there in different language then this class ensures the .NET that actually they are the same. E.g. int in C++ is same to integer in VB.net and numeric of SQL.
System.Linq
Providing classes to link a source and enable the application to query the data.
Design for
A Simple window application  Add, Subtract, and Multiply

 




Addition Code

private void btnAdd_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result=num1+num2;
            rslt = result + "";
            txtResult.Text = rslt;
Subtraction Code
private void btnSub_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result = num1 - num2;
            rslt = result + "";
            txtResult.Text = rslt;
       }
Multiplication Code
private void btnMul_Click(object sender, EventArgs e)
        {
            int num1, num2, result;
            String rslt;
            num1 = Convert.ToInt32(txtNum1.Text);
            num2 = Convert.ToInt32(txtNum2.Text);
            result = num1 * num2;
            rslt = result + "";
            txtResult.Text = rslt;
        }





No comments:

Post a Comment

The .NET Framework Architecture

Common Language Specification (CLS) Enables cross-language interoperability Common Language Specification describes interoperabili...