+ All Categories
Home > Documents > .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework....

.Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework....

Date post: 26-Dec-2015
Category:
Upload: nathan-lang
View: 215 times
Download: 0 times
Share this document with a friend
25
.Net Training Lecture – 1 Author: Suhrid Patel
Transcript
Page 1: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

.Net Training

Lecture – 1

Author: Suhrid Patel

Page 2: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is .NET ?

It is a platform neutral framework.

Is a layer between the operating system and the programming language.

It supports many programming languages, including VB.NET, C# etc.

.NET provides a common set of class libraries, which can be accessed from any .NET based programming language. There will not be separate set of classes and libraries for each language. If you know any one .NET language, you can write code in any .NET language!!

In future versions of Windows, .NET will be freely distributed as part of operating system and users will never have to install .NET separately.

Page 3: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is Not ?

.NET is not an operating system.

.NET is not a programming language.

Page 4: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Currently .NET supports the following languages: C#

VB.NET

C++

J#

Page 5: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is the CLR? CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article:Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection)  Security model Type system All .NET base classes  Many .NET framework classes Development, debugging, and profiling tools Execution and code management  IL-to-native translators and optimizers What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services

Page 6: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is CLS (Common Language Specificaiton)?

It provides the set of specifications which has to be adhered by any new language writer / Compiler writer for .NET Framework. This ensures Interoperability.

For example: Within an ASP.NET application written in C#.NET language, we can refer to any DLL written in any other language supported by .NET Framework. As of now .NET Supports around 32

languages.

Page 7: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is CTS (Common Type System)?

It defines about how Objects should be declared, defined and used within .NET. CLS is the subset of CTS.

This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.

Page 8: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What is IL? IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-

Time (JIT) compiler

Page 9: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

What are the different types of

assemblies available and their purpose? Private, Public/shared and Satellite Assemblies.

Private Assemblies : Assembly used within an application is known as private assemblies.

Public/shared Assemblies : Assembly which can be shared across applicaiton is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).

Satellite Assemblies : These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying an Gloabl applicaiton for different languages

Page 10: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Explain the differences between Server-

side and Client-side code? Server side scripting means that all the script will be executed by the server and  interpreted as needed.

ASP doesn't have some of the functionality like sockets, uploading,  etc. For these you have to make a custom components usually in VB or VC++.

Client side  scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in  VBScript or JavaScript. Download time, browser compatibility, and visible code - since  JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer

Page 11: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Difference between asp and asp.net?

ASP (Active Server Pages) and ASP.NET are both server side technologies for building web sites and web applications. ASP.NET is Managed compiled code - asp is interpreted. ASP.net is fully Object oriented. ASP.NET has been entirely re-architected to provide a highly productive programming experience based on the .NET Framework, and a robust infrastructure for building reliable and scalable web applications.

Page 12: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Visual Studio for .Net

Many people always get confused with Visual Studio .NET (VS.NET) and .NET technology. VS.NET is just an editor, provided by Microsoft to help developers write .NET programs easily. VS.NET editor automatically generates lot of code, allows developers to drag and drop controls to a form, provide short cuts to compile and build the application etc.

VS.NET is not a required thing to do .NET programming. You can simply use a notepad or any other simple editor to write your .NET code!!! And you can compile your .NET programs from the

command prompt.

Page 13: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

"Java is platform independent, what about .NET ?".

The answer is "Yes" and "No" !

The code you write is platform independent, because whatever you write is getting compiled into MSIL. There is no native code, which depends on your operating system or CPU. But when you execute the MSIL, the .NET framework in the target system will convert the MSIL into native platform code.

Page 14: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Creating a Project

Page 15: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

ToolBox

Page 16: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Solution Explorer

Page 17: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Output window

Page 18: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

ASP.Net Modes

Page 19: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

C# Language Syntax

Variable Declarationint a;int salary, incomeTax, sum;int count = 10;

string name;string fullName= "Little John";

While Loop

int i = 0;while ( i < 5 ){Console.WriteLine ( i );++i;}

Page 20: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

For Loopint i = 0;for ( int i = 0; i < 5; i++ ){Console.WriteLine ( i );}

For Each Loopstring [] names = new string[]{ "Little John", "Pete", "Jim", "Bill" };foreach ( string name in names ){Console.WriteLine ( name );}

Page 21: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

If Else Conditionstring name = "Little John";if ( name == "Jim" ){Console.WriteLine( "you are in 'if' block" );}else{Console.WriteLine( "you are in 'else' block" );}

Break Condition

string [ ] names = new string[] { "Little John", "Pete", "Jim", "Bill" };foreach ( string name in names ){Console.WriteLine ( name );if ( name == "Pete" )break;}

Page 22: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Continuestring [ ] names = new string[ ]{ "Little John", "Pete", "Jim", "Bill" };

foreach ( string name in names ){if ( name == "Pete" )continue;

Console.WriteLine ( name );}

Page 23: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Switch Caseint i = 3;switch ( i ){case 5:Console.WriteLine( "Value of i is : " + 5 );break;case 6:Console.WriteLine( "Value of i is : " + 6 );break;case 3:Console.WriteLine( "Value of i is : " + 3 );break;case 4:Console.WriteLine( "Value of i is : " + 4 );break;default:Console.WriteLine( "Value of i is : " + i );break;}

Page 24: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

C# Data Types

C# Data type Mapped to .NET class/struct Sbyte System.SByte Byte System.Byte Char System.Char Float System.Single Decimal System.Decimal Double System.Double Ushort System.UInt16 Short System.Int16 Uint System.UInt32 Int System.Int32 Ulong System.UInt64 Long System.Int64 Bool System.Boolean String System.String Object System.Object

Page 25: .Net Training Lecture – 1 Author: Suhrid Patel. What is.NET ? It is a platform neutral framework. Is a layer between the operating system and the programming.

Example of Classusing System;

public class Calculator{public int Add(int value1, int value2){return value1 + value2;}

public int Subtract(int value1, int value2){return value1 - value2;}

public int Multiply(int value1, int value2){return value1 * value2;}

public int Divide(int value1, int value2){return value1 / value2;}}


Recommended