introduction to .net with c# @ university of wayamba

23
Microsoft .NET with C# The choice of real engineers… Prepared & Presented by :- Prageeth Sandakalum, Microsoft Student Champ

Upload: prageeth-sandakalum

Post on 24-Apr-2015

531 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Introduction to .NET with C# @ university of wayamba

Microsoft .NET with C#The choice of real engineers…

Prepared & Presented by :-Prageeth Sandakalum, Microsoft Student Champ

Page 2: Introduction to .NET with C# @ university of wayamba

Agenda of the Day…

Microsoft .NET FrameworkWhat is a “framework”

An overview of the .NET Virtual Machine Inside the .NET framework .NET framework language support .NET framework class library C# Language Vs Java Completely new features in C# Before you begin Writing the first C# code Visual Studio Fun…

Page 3: Introduction to .NET with C# @ university of wayamba

Agenda of the Day Contd…C# .NET Language

Access modifiers, Conditions, LoopsObject Oriented Programming in C#

Classes and ObjectsInheritancePolymorphismEncapsulation

Value Types Vs Reference Type C# special language features

Enumerations, Nullable Types, Partial Classes, Operator Overloading

Windows Forms

Page 4: Introduction to .NET with C# @ university of wayamba

All in 1 solution for a programmer…

.NET Framework (3.5)

.NET ??We have many. Why

another 1?

Page 5: Introduction to .NET with C# @ university of wayamba

What is a Framework?

A framework a set of ideas, principles, agreements, or rules that provides the basis or outline for something intended to be more fully developed at a later stage

- MSN Encarta -

A software framework is a re-usable design for a software system (or subsystem). A software framework may include support programs, code libraries, a scripting language, or other software to help develop and glue together the different components of a software project.

- Wikipedia -

Page 6: Introduction to .NET with C# @ university of wayamba

.NET Framework & CLR

Language neutral.

many languages with a common class library

Provides a runtime and a set of common libraries for writing

and executing written programs in any compliant language.

The runtime is called the .NET CLR (Common Language

Runtime) – similar to the Java Runtime.

CLR Provides the functionality to Activate objects, perform security Checks, Memory Allocation,

Execution, etc…

Page 7: Introduction to .NET with C# @ university of wayamba

Inside the .NET Framework

Common Language Runtime Executes code, maintains

security, handles component “plumbing” and dependencies

Secure, integrated class libraries Unifies programming

models across languages Enables cross-language

integration Factored for extensibility Designed for tools Create frameworks on

top of the high level .NET framework

ASP.NET High-productivity environment

for building and running Web services

Operating System

Common Language Runtime

Base Class Library

ADO .NET and XML

ASP .NETWeb Forms Web Services

Mobile Internet Toolkit

WindowsForms

Common Language Specification

VB C++ C# J# …

Visu

al S

tudio

.NET

Page 8: Introduction to .NET with C# @ university of wayamba

.NET Framework language support

Common Language Specification.

First class support for all CLS compliant languages.

Microsoft provided languages.

Visual Basic®, C#, C++, J#, JScript®.

3rd-party provided languages

APL, Cobol, Component Pascal, Eiffel, Fortran, Haskell, Mercury,

Oberon, Oz, Perl, Python, RPG, Scheme, Smalltalk, Standard ML,

Ruby, Delphi and the list is growing!

Page 9: Introduction to .NET with C# @ university of wayamba

.NET Framework class library

Spans All Programming Languages.Enables cross-language inheritance and debugging.Integrates well with tools.

Is Object-Oriented and Consistent.Enhances developer productivity by reducing the number of

APIs to learn.

Has a Built-In Common Type System.Is Extensible.

Makes it easy to add or modify framework features.

Is Secure.Allows creation of secure applications.

Page 10: Introduction to .NET with C# @ university of wayamba

C# & Java

As in JavaObject-Orientation with single inheritance

Interfaces

Exceptions

Threads

Packaging

Garbage Collection

Reflection

Dynamic loading of code

Page 11: Introduction to .NET with C# @ university of wayamba

C# Special… References and output parameters Objects on the stack (structs) Attributes Indexers Partial Types Loosely Typed Variables Enumerations Operator Overloading Nullable types Lambda Expressions …

Page 12: Introduction to .NET with C# @ university of wayamba

Before you begin Dynamic Link Libraries Adding references Adding Projects Structuring the Code Using the .DLLs Namespaces Adding files to the projects Aliases Adding arguments Console.Read()

Page 13: Introduction to .NET with C# @ university of wayamba

Finally C# !!!!

Let’s start Coding and take a tour in Visual Studio..!

Page 14: Introduction to .NET with C# @ university of wayamba

The Finest roadmap in application development

C#.NET Language Features

Page 15: Introduction to .NET with C# @ university of wayamba

C# Basics Access Modifiers

Private, Public, protected Internal, internal protected

Variable declaration Static, Constant, Var

IF – ELSE – ELSE IF Switch-Case Arrays Loops

For, While, Do-While, Foreach

Page 16: Introduction to .NET with C# @ university of wayamba

Exercise 1.0Write a small program to take 3 numbers using command line arguments and insert into the array. Then add these numbers. If the total is larger than 100 print a message…

Page 17: Introduction to .NET with C# @ university of wayamba

OOP with C# Declaring classes Creating Object Inheritance

Sealed Classes, Interfaces Polymorphism

Overriding, Overloading Encapsulation

Properties Special Keywords

params, ref

Page 18: Introduction to .NET with C# @ university of wayamba

Exercise 2.0Write a program to create an Animal super class and create a Cat, Dog classes which extends it… Use properties to initialize the number of legs each animal has.

Exercise 2.1Write a program to test the ref variable and the params keyword

Page 19: Introduction to .NET with C# @ university of wayamba

Reference Types Vs Value Types

Page 20: Introduction to .NET with C# @ university of wayamba

C# Special Features

Structs Value type representation of classes Ideal for Light weight objects or heavily used objects

Polygon, Rectangle classes Fraction class in a mathematical project

Enumerations

Nullable Types

Partial Classes

Operator Overloading

Page 21: Introduction to .NET with C# @ university of wayamba

Exercise 3.0Create a struct for complex numbers.. Use operator overloading to implement the multiplication

Page 22: Introduction to .NET with C# @ university of wayamba

Windows Programming in C#

Let’s create a simple Windows Based Client Application in C#.NET using Visual Studio..!

Page 23: Introduction to .NET with C# @ university of wayamba

Thank You !!!

Contact me for further clarificationPrageeth Sandakalum

[email protected]