Learn .net With Clement-1

  • Uploaded by: P Clement Lloyd
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Learn .net With Clement-1 as PDF for free.

More details

  • Words: 1,103
  • Pages: 7
Hi Folks ! This Is Clement And I Am Back With My Study Experience in .Net Framework Basics, after a long time. I Hope That These Pieces Of Document Really Help You Understand The Basic Concepts In a Simpler Manner And Grow in us a Passion for .Net Technology ! In This Section I shall Deal With The Following And I Won’t Be Beating Around The Bush !!! 1)The Architecture Of A System With .Net Framwork. 2)The .Net Framework Architecture along with he Different Parts Explained.

1) ARCHITECTURE OF THE SYSTEM WITH .NET FRAMEWORK Visual Studio .Net Services .Net Framework .Net Building Blocks

Operating System

Here The Operating System Forms The Base .On top of it is a layer consisting of the .Net Framework, .Net Services which Include Data and other Servers Which Help us to manage Data , for example-SQL Server…The .Net Building Block is in fact an outcome of the .Net Framework along With The .Net Services for example-.Net Passports.

2) .Net Framework

Web Forms Windows Forms Web Services

Data and XML Classes All The Basic And Fundamental Classes Common Language Runtime

Note That all that you are dealing in .Net are objects That are derived from the namespace: System.Object….That means everything in .net is actually an object of the class “Object”.This is the basic class and forms the basis for all the other .Net Classes.

a) CLR(Common Language Runtime) Friends , This is the Heart of The .Net Framework.It acts as a code executioner.For Someone Who is familiar to javaCLR can be compared to the Java Virtual Machine.Okay before understanding when and how this CLR functions, it is important to know about the Executable files that .Net can handle.It may seem Surprising but after you read through you will be crystal clear…Ha …Ha…Ha….Ok Lets Carry on….

One Question to all of You Has anyone of you tried executing a executable(.exe to be simple) file of a program that has been written using the .Net Framework , Without the .Net Framework Being Installed on the System .To those who have not , The answer is  The Operating System won’t run the program…….This is because of the fact that there is something called the common Object File Format which has specified a Portable Executable(PE) format for all Windows Executables.

Yes, All The Windows Executables are in the PE Format.They have a header and an reference to the data they contain. PE Header Reference(.data,.rdata)

Whenever You execute a Windows executable(.exe or .dll), Windows Checks if the file is in the PE Format..If So then it Executes it else Throws an error.

Now .Net Executables are also in PE Format but some additional information is added like CLR Header and CLR Data. PE Header CLR Header CLR Data Metadata IL code

Reference(.data,.rdata)

Got The Difference? When You execute the file of this format, Windows Sees the CLR header and Transfers the control to the CLR.Now if no .Net Framework is installed- no CLR-then no execution possible….Understood??? Ok Now When the CLR Gets Control..It has 5 main functions to do -Activate the objects -Perform security checks - Loads the objects into the memory -Executes them -Garbage collects them

The Architecture of a CLR is as follows The PE Format File containing the Intermediate Language Just in Time Compiler---Verifies code and compiles code to Native code Native code

Now What is IL or Intermediate Code--Hmmmm..Now The PE File Consists of Metadata and IL.Metadata is “Data about Data”, i.e it tells the CLR which assemblies are necessary for the execution of the program so that the CLR loads them prior to execution.It Tells JIT to load the required classes.It consists of all the information of the assemblies that can be accessed by the assemblies that are being loaded by the CLR prior to execution.Hence Meadata is very important. Common Intermediate Language or Microsoft Intermediate Language or Intermediat e language consists of the different assembly instructions and the entry points for the CLR to access the program.The Entry Point may be one of the three functions-Main(),WinMain(),DllMain(). The Intermediate Language is similar to Byte code in Java.The Difference being that all the languages supported by .Net can produce IL but only java can produce byte code.Byte code runs on machines having JVM-any platform but IL—only in windows platform.

b)CTS and CLS .Net supports Language Integration and Interoperability. You can Write one module in C# and other in VB and then integrate these two modules, call a function in one from the other module…. CTS or Common Type System lays down a set of rules that a compiler must comply to in order to support Language Interoperability. Whereas CLS or common language specification says that the compiled code must be in the form of Common Intermediate language to help Language Integration.

CTS has laid down some Types that any .Net compatible Program must possess in order to be intergratable because all these types have the similar meaning in all the different languages: -Value Types

-Reference Types -Delegates -Classes -Interfaces

Value Types Value types represent Values allocated on the memory stack. These Cannot ne Null.When Value Types are passed onto funcyions their copy is made and passed.Any change to the duplicate version won’t affect the original one.Value types are useful when the object is small. Ex: primitives int i=1 Structures Struct Clem{int x,inty}; Enumerations.

Reference Types

These Represent some heap based objects and show the address or act as a pointer to values in the stack.The modification to these will modify the original data.These are used when objects are large.

Ex: Arrays Classes Interfaces Delegates Now youcan convert a Value type to a Reference type(Boxing) and Vice Versa(UnBoxing) Boxing example: Int i=1 //Value Type

Object x = I //x now points to I and x can be manipulated by functions such as ToString() UnBoxing Int I = (int)x//by the process of casting

Delegates Delegates are very special coz they are the basis for the concept of EVENT HANDLING.I do not have deep knowledge in delegates but can provide you with information which will give you some basic idea… These are similar to function pointers in C. They have a definite prototype which any of its function must follow. Example: Using System; Class DelExample { Delegate Void Msg(String Ms);//callback prototype Void Msgh(String h)//callback method { Console.Writeln(h); } } Public Static Void Main() { DelExample t = new DelExample(); Msg f = new Msg(t.Msgh); f(“hello”);//invoke method indirectly }

That’s all in this Episode Folks…Ill Keep Writing Whenever I get Time…Please do go through these items and send me your response either by posting in this website or via email Regards, Clement [email protected]

Related Documents

Learn
June 2020 18
Learn
November 2019 37

More Documents from ""