Upload
gajendra-deshpande
View
219
Download
2
Embed Size (px)
DESCRIPTION
C# Programming and .net Unit I Presentation
Citation preview
Mr. G.C.Deshpande
Lecturer, [email protected]
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.
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.
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].
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
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
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
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
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
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)
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
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
Building Blocks of the .NET Building Blocks of the .NET PlatformPlatform
Figure 1.1: The CLR, CTS, CLS and base class library relationship
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
An Overview of .NET An Overview of .NET Assemblies Assemblies
Figure 1.2: All .NET-aware compilers emit IL instructions and metadata
The Role of the CILThe Role of the CIL
The Role of the CILThe Role of the CIL
The Role of the CILThe Role of the CIL
The Role of the CILThe Role of the CIL
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
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
The Role of .NET Type MetadataThe Role of .NET Type Metadata
(methods, properties)
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
The Role of the Assembly The Role of the Assembly ManifestManifest
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
CTS class typesCTS class types
Table 1.1: CTS class characteristics
CTS structure typesCTS structure types
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
CTS Interface typesCTS Interface types
CTS Enumeration typesCTS Enumeration types
CTS delegate typesCTS delegate types
Intrinsic CTS data typesIntrinsic CTS data typesTable 1.2: The intrinsic CTS data types
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
The Common Language The Common Language SpecificationSpecification
Ensuring CLS ComplianceEnsuring CLS Compliance
The Common Language The Common Language RuntimeRuntime
Figure 1.3: mscoree.dll in action
The .NET NamespacesThe .NET Namespaces
Accessing a Namespace Programmatically Referencing External Assemblies
The .NET NamespacesThe .NET Namespaces
The .NET NamespacesThe .NET Namespaces
The .NET NamespacesThe .NET Namespaces
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
Contact MeContact Me
Email: [email protected]
Blog: gcdeshpande.spaces.live.com
Follow on twitter: www.twitter.com/gcdeshpande