Documente Academic
Documente Profesional
Documente Cultură
ER/CORP/CRS/LA1007/003
Copyright 2007, Infosys Technologies Ltd
Ver. No.:1.0
Course Objectives
To understand .NET technology and .NET framework To gain ability to work in Visual Studio 2005 Team System IDE To learn Object Oriented Concept and its use in C# To gain ability to do windows programming and event handling Usage of built-in testing and code analysis tools in Visual Studio 2005 Team System for coding standards and testing in .NET framework
Course Pre-requisites
Fundamental programming skills C as a programming language
Expectations
At the end of the Basic .NET Programming using C# module, the candidate should be conversant with the following
.NET 3.0 architecture Object Oriented Concepts Development of console application, windows application and class libraries Usage of built-in testing and code analysis tools in Visual Studio 2005 Team System for coding standards and testing in .NET framework Working on Visual Studio 2005 Team System
Course Agenda (1 of 3)
Session Plan - Day 1
Introduction to .NET Framework 3.0 technology Structure of C# program Data types in C# Introduction to class and object Arrays Introduction to Visual Studio 2005 Team System IDE Debugging using Visual Studio 2005 Team System Classes and objects this keyword Static data member, method, constructor Property Indexer Inheritance, Method overloading
Course Agenda (2 of 3)
Session Plan - Day 3
Method overriding, Dynamic Polymorphism Abstract class and method Interface Introduction to namespace System.Object Boxing and unboxing Typecasting Destructor, IDisposable interface
Generics
Class Method Collection
Iterators Constraints
7
Course Agenda (3 of 3)
Session Plan - Day 5
GUI - Windows Application Partial Classes Delegates Anonymous methods Events Attributes
References
www.msdn.com http://www.c-sharpcorner.com/ Troelsen,Andrew, C# and the .Net Platform , Apress Archer,Tom , Inside C#, Wrox Publication Sharp, John, Microsoft Visual C# 2005 Step by Step, Microsoft, 2005
11
Why .NET?
Need to create a new project re using
Applications developed in different languages. Incorporating them in a single project will be a NIGHTMARE!
13
Why .NET?
A nightmare? Not anymore. Microsoft .NET is a simple solution to this seemingly nightmarish situation. Equipped with various new features, it provides you with interoperability
Interoperability
Components of applications written in one programming language can be used for applications developed in other programming languages
14
Hence Microsoft .NET Framework a computing platform for developing distributed applications for the Internet.
15
15
Evolution of Technology
Positives of Internet Browsing Era: Global connectivity Simplicity Mainstream
GUI Era
Negatives of Internet Browsing Era: Read-only No user control Too many islands Keyboard only
Technology Drivers
Computing power
Still doubling every 12 months
Connectivity
Low cost, broad reach Internet and Wireless, broadband access
Device proliferation
Multiple devices - PDAs, Mobile phones
Internet Standards
XML-Based integration
20
Before COM, applications were completely separate entities with little or no integration
21
COM provides a way for components to integrate; However, each component must provide the plumbing and objects cannot directly interact
22
With the .NET Framework common language runtime (CLR), components are built on a common substrate; No plumbing is needed and objects can directly interact
23
Integration Is Intrinsic
Assembly Fundamental unit of development, deployment, execution, security and versioning A collection of one or more files grouped together to form a logical unit
24
Web Services
SOAP on Protocol 1
Web Service
Language A in Platform B
SOAP on Protocol 2
Client Language Y in Platform N
25
Web Services
A programmable application component accessible via standard Web protocols Web Services will allow people, companies, customers, suppliers, doctors, patients etc. to interact using different computers, different operating systems, and different applications
26
Provide Security
provide a high level of Code Access Security that enables administrators and developers to authorize applications similar to the way they have always been able to authorize users
Ensure Acceptability
Using web standards and best practices to ensure the maximum acceptability of the applications developed
27
.NET
What is .NET? The set of Microsoft software technologies Connecting the world of information, systems, people and devices. Small applications communicating with other applications
Located on the same machine or Via the Internet.
What is .NET Framework? A new computing platform Simplifies application development in the highly distributed environment of Internet
28
Web Clients
Web Forms
Web Services
Consumer Applications
Windows OS
29
Enables software as a service Based on XML SOAP is a W3C standard. Strong third party support
Web Services XML, SOAP, HTTP, HTML
31
Foundation for building, deploying, and running Web Services Productive, extensible, multilanguage Integration through public Internet standards
32
.NET Framework
.NET Languages
C Visual C++ Visual Basic Visual C# Smalltalk Oberon Scheme Mercury Python
33
Visual Studio.NET
Most productive tool for developing Web Services, applications Unified programming model, IDE Builds on todays capabilities
.NET Framework
Partners
ADA
APL COBOL Pascal Eiffel Visual Perl Visual Python Smalltalk and many more
Visual Studio.NET
.NET Framework
35
Features of .NET
Distributed Systems
Easy Deployment
Extensibility
36
37
38
Managed code
Assembly IL Code
40
Start
OS
Compiler
EXE/DLL (IL)
Policy
Class Libraries (IL)
IS Permissions?
Class Loader
Target Machine
Security Exception
Y Is Type Safe ?
Y N Is PreJIT ? JIT N Type Safe Exception
JIT Compiler
Security Check
Execution
Y Execution IL
41
Features of CLR
Automatic Memory Management
Provides garbage collection
Language Interoperability
Platform Independence
Security Management
Provides Code Access Security (CAS) Type Safety
42
44
45
Web Clients
Consumer Applications
Internal/externalMicrosoft .NET Foundation Microsoft .NET enterprise Web Services Web Services Web Services
48
48
49
49
WPF
WF
50
Features of C Sharp
Object-oriented Simpler language
Compared to earlier OO languages like C++, it is simple Designed considering the pitfalls of earlier languages
52
What is a Class ?
A Class
Is a blue print used to create objects. Is a software template that defines the methods and variables to be included in a particular kind of Object.
Examples :
Animal, Human being, Automobiles, Bank Account, Customer
54
What is an Object ?
An object
Is an unique, identifiable, self-contained entity that contains attributes and behaviors. A software object is modeled after real world objects
A software object is a representative of the real world object
55
Class Contains ..
State (Member variables)
The internal state of the object represented by values stored in member
variables
Variables defined inside a class form the state of the class Not exposed to external world
56
Behavior
Bark Wag Tail Eat
57
object
EmpNo
setName()
Jodie 4001 Daria 4002 Jane 4003 Brittany 4004
setEmpNo() CalcSalary()
58
Structure of a C# program
using System;
class FirstProgram
{ public static void Main() { Console.WriteLine(Hello World); } }
Data Types in C#
Value Types Reference Types
Value types include simple types like char, int, and float, enum types, and struct types Variable holds the actual value
Allocated on stack
Reference types include class types, interface types, delegate types, and array types Variable holds memory location
Allocated on heap
60
Integer
Floating Point
float
Character
Boolean
byte sbyte
Char
bool
61
A structure of a Class in C#
class ClassName { DataType1 MemberVariable1; ClassType2 Object2; /* A data members can be defined using 1) primitive types (int, float, string ) 2) user defined structures 3) object reference of a class */ ClassName( parameters ) { /* The constructor is used for members initialization during the object creation */ } return-type MethodName( parameters ) { /* All the application logics have to be placed inside the methods. A method must be placed inside a class.*/ } }// End of the class
63
67
String
System.String
68
Methods
Append() Insert() Remove() Replace()
StringBuilder str = new StringBuilder (hi); str.Append(how are you?) str.Insert(6,How do you do?);
69
Arrays
Every array in C# is an object Two ways of creating one dimensional array
/* Creating the array reference and initializing it in two steps */ Type [ ] arrayObj; arrayObj = new Type[ capacity ]; /* Creating the array reference and initializing it in a single step */ Type [ ] arrayObj = new Type[ capacity ];
Two ways of initializing array elements during the Array object creation
Type [ ] arrayObj; arrayObj = new Type[ ] { value1, value2, value3, }; Type [ ] arrayObj = { value1, value2, value3, }; <<Demo : Arrays>>
70
Questions on Self study topics What do you mean by jagged arrays? Which feature is different in the switch statement in C# as compared to in C?
71
72
Infrastructure Architect
Project Manager
74
Summary
Introduction to .NET technology Structure of C# program Data types in C# Introduction to class and objects Arrays Introduction to Visual Studio 2005 Team System IDE
75
Thank You
The contents of this document are proprietary and confidential to Infosys Technologies Ltd. and may not be disclosed in whole or in part at any time, to any third party without the prior written consent of Infosys Technologies Ltd. 2006 Infosys Technologies Ltd. All rights reserved. Copyright in the whole and any part of this document belongs to Infosys Technologies Ltd. This work may not be used, sold, transferred, adapted, abridged, copied or reproduced in whole or in part, in any manner or form, or in any media, without the prior written consent of Infosys Technologies Ltd.