43
Mr. G.C.Deshpande Lecturer, [email protected]

06CS761 PPTs Chapter I

Embed Size (px)

DESCRIPTION

C# Programming and .net Unit I Presentation

Citation preview

Page 1: 06CS761 PPTs Chapter I

Mr. G.C.Deshpande

Lecturer, [email protected]

Page 2: 06CS761 PPTs Chapter I

The .NET VisionThe .NET Vision

Seeing brings about evolution. Vision brings about revolution.

.NET is Microsoft’s vision of how computing is going to take place in future. .NET offers a whole new paradigm that will change the way you think about writing software.

Page 3: 06CS761 PPTs Chapter I

Topic Level ObjectivesTopic Level ObjectivesTo lay the conceptual groundwork for remaining chapters.To confabulate about .NET related topics such as assemblies, the Common Intermediate Language (CIL), and just-in-time (JIT) compilation. To preview some key features of the C# programming language. To throw light on the relationship between various aspects of the .NET Framework, such as Common Language Runtime (CLR), the Common Type System (CTS), and the Common Language Specification (CLS). To endow with an overview of the .NET binaries and the functionality supplied by the .NET base class libraries.

Page 4: 06CS761 PPTs Chapter I

Intended Learning OutcomesIntended Learning Outcomes

1. Investigate limitations and complexities found within the technologies prior to .NET [L 4].

2. Explain the building blocks of .NET platform [L 2].

3. Discuss the role of .NET base class libraries [L 2].

4. Discuss the role of CIL and its benefits [L 2].

5. Distinguish between single-file and multi file assemblies [L 2].

6. Discuss the role of .NET type metadata and assembly manifest [L 2].

7. Explain the CTS and CLR [L 2].

8. Discuss Common Language Specification [L 2].

9. Write CLS compliant code [L 5].

10.Deploy the .NET runtime [L 3].

Page 5: 06CS761 PPTs Chapter I

Understanding the Previous Understanding the Previous State of AffairsState of Affairs Life As a C/Win32 API Programmer Life As a C++/MFC Programmer Life As a Visual Basic 6.0

Programmer Life As a Java/J2EE Programmer Life As a COM Programmer Life As a Windows DNA Programmer

Page 6: 06CS761 PPTs Chapter I

Life As a C/Win32 API Life As a C/Win32 API ProgrammerProgrammer C +Windows API Complex undertaking C is terse language

Manual memory management Ugly pointer arithmetic Ugly syntactical constructs

Lacks object-oriented approach

Page 7: 06CS761 PPTs Chapter I

Life As a C++/MFC ProgrammerLife As a C++/MFC Programmer

Improvement over C/API Continuation of painful aspects of C

language MFC- C++ Framework – provides set of

existing C++ classes that facilitate the construction of Windows Applications.

C++ remains as a difficult and error-prone experience

Page 8: 06CS761 PPTs Chapter I

Life As a VB 6.0 ProgrammerLife As a VB 6.0 Programmer

Kinder and gentler language Build Complex UI, Code libraries, Data

Access logic Integrated code wizards, Intrinsic data

types, classes and VB-centric functions Not fully object oriented No classical inheritance No support for parameterized class

construction No support for multithreaded applications

Page 9: 06CS761 PPTs Chapter I

Life As a Java/J2EE programmerLife As a Java/J2EE programmer

Almost completely object oriented Java is Language + Platform Little hope for language

independence (against Java’s primary goal)

Not appropriate for graphically and numerically intensive applications

Little support for true cross language integration

Page 10: 06CS761 PPTs Chapter I

Life As a COM ProgrammerLife As a COM Programmer

“If you build your classes in accordance with the rules of COM, you end up with a block of reusable binary code”

Binary COM servers can be accessed in a language independent manner

Limited language independence (no classical inheritance) – “has-a” relationship

Location transparent nature(AppIDs, stubs, proxies, com runtime environments). Avoid raw sockets and RPC calls

DLL hell problem (registration and deployment issues)

Page 11: 06CS761 PPTs Chapter I

Life As a Windows DNA Life As a Windows DNA ProgrammerProgrammer Distributed iNternet Architecture Windows DNA (ASP,HTML,

XML,ADO, VBScript, JavaScript, COM)

Syntactically unrelated Each language has its own type

system

Page 12: 06CS761 PPTs Chapter I

The .NET SolutionThe .NET Solution

Full Interoperability with existing code

Complete and total language integration

A common runtime engine shared by all .NET-aware languages

A base class library No more COM plumbing A truly simplified deployment model

Page 13: 06CS761 PPTs Chapter I

Building Blocks of the .NET Building Blocks of the .NET PlatformPlatform

Figure 1.1: The CLR, CTS, CLS and base class library relationship

Page 14: 06CS761 PPTs Chapter I

What C# Brings to the TableWhat C# Brings to the Table

No pointers required ! Automatic memory management Formal syntactic constructs C++ like abilities Generic types and generic members Full support for Interface-based

programming techniques Full support for aspect-oriented

programming (AOP) techniques

Page 15: 06CS761 PPTs Chapter I

An Overview of .NET An Overview of .NET Assemblies Assemblies

Figure 1.2: All .NET-aware compilers emit IL instructions and metadata

Page 16: 06CS761 PPTs Chapter I

The Role of the CILThe Role of the CIL

Page 17: 06CS761 PPTs Chapter I

The Role of the CILThe Role of the CIL

Page 18: 06CS761 PPTs Chapter I

The Role of the CILThe Role of the CIL

Page 19: 06CS761 PPTs Chapter I

The Role of the CILThe Role of the CIL

Page 20: 06CS761 PPTs Chapter I

The Role of the CILThe Role of the CIL

Benefits of CIL Language Integration Platform-Agnostic

Compiling CIL to Platform-Specific Instructions

just-in-time compiler or jitter• Jitter for handheld device – low memory environment• Jitter for Backend server – high memory environment

Page 21: 06CS761 PPTs Chapter I

The Role of .NET Type MetadataThe Role of .NET Type Metadata

Describes each and every type (class, structs) defined in the binary and members (methods, properties) of each type

Compiler emits the latest type metadata Intellisense feature of VS Debugging tools C# Compiler Backbone of WCF, Reflection, late binding,

Object serialization etc

Page 22: 06CS761 PPTs Chapter I

The Role of .NET Type MetadataThe Role of .NET Type Metadata

(methods, properties)

Page 23: 06CS761 PPTs Chapter I

The Role of Assembly ManifestThe Role of Assembly Manifest

Metadata that describes assembly itself The manifest documents all external

assemblies required by the current assembly to function correctly, the assembly’s version number, copyright information, and so forth.

Generated by compiler

Page 24: 06CS761 PPTs Chapter I

The Role of the Assembly The Role of the Assembly ManifestManifest

Page 25: 06CS761 PPTs Chapter I

The Common Type SystemThe Common Type System

CTS class types CTS structure types CTS Interface types CTS Enumeration types CTS delegate types CTS type members Intrinsic CTS data types

Page 26: 06CS761 PPTs Chapter I

CTS class typesCTS class types

Table 1.1: CTS class characteristics

Page 27: 06CS761 PPTs Chapter I

CTS structure typesCTS structure types

Page 28: 06CS761 PPTs Chapter I

Differences between classes Differences between classes and structsand structs Structs are value types All struct types implicitly inherit from the class

System.ValueType Assignment to a variable of a struct type creates a

copy of the value being assigned The default value of a struct is the value produced by

setting all value type fields to their default values and all reference type fields to null

Boxing and unboxing operations are used to convert between a struct type and object

The meaning of this is different for structs A struct is not permitted to declare a parameterless

instance constructor A struct is not permitted to declare a destructor

Page 29: 06CS761 PPTs Chapter I

CTS Interface typesCTS Interface types

Page 30: 06CS761 PPTs Chapter I

CTS Enumeration typesCTS Enumeration types

Page 31: 06CS761 PPTs Chapter I

CTS delegate typesCTS delegate types

Page 32: 06CS761 PPTs Chapter I

Intrinsic CTS data typesIntrinsic CTS data typesTable 1.2: The intrinsic CTS data types

Page 33: 06CS761 PPTs Chapter I

The Common Language The Common Language SpecificationSpecification

Rule 1: CLS rules apply only to those parts of a type that are exposed outside the defining assembly

Page 34: 06CS761 PPTs Chapter I

The Common Language The Common Language SpecificationSpecification

Page 35: 06CS761 PPTs Chapter I

Ensuring CLS ComplianceEnsuring CLS Compliance

Page 36: 06CS761 PPTs Chapter I

The Common Language The Common Language RuntimeRuntime

Figure 1.3: mscoree.dll in action

Page 37: 06CS761 PPTs Chapter I

The .NET NamespacesThe .NET Namespaces

Accessing a Namespace Programmatically Referencing External Assemblies

Page 38: 06CS761 PPTs Chapter I

The .NET NamespacesThe .NET Namespaces

Page 39: 06CS761 PPTs Chapter I

The .NET NamespacesThe .NET Namespaces

Page 40: 06CS761 PPTs Chapter I

The .NET NamespacesThe .NET Namespaces

Page 41: 06CS761 PPTs Chapter I

ReferencesReferences

1] Andrew Troelsen, Pro C# with .NET 3.0, Special Edition,

Dream tech Press, India, 2007.

2] E. Balagurusamy, Programming in C#, 5th Reprint, Tata McGraw Hill,

2004 (For Programming Examples).

3] Tom Archer, Inside C#, WP Publishers, 2001.

4] Herbert Schildt, C#: The Complete Reference, TMH, 2004. 

5] Yashavant Kanetkar, C#.NET fundas, First Edition, BPB Publications,

2002

 

Page 42: 06CS761 PPTs Chapter I

Contact MeContact Me

Email: [email protected]

[email protected]

Blog: gcdeshpande.spaces.live.com

Follow on twitter: www.twitter.com/gcdeshpande

Page 43: 06CS761 PPTs Chapter I