introduction to .net with c# @ university of wayamba
DESCRIPTION
TRANSCRIPT
Microsoft .NET with C#The choice of real engineers…
Prepared & Presented by :-Prageeth Sandakalum, Microsoft Student Champ
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…
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
All in 1 solution for a programmer…
.NET Framework (3.5)
.NET ??We have many. Why
another 1?
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 -
.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…
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
.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!
.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.
C# & Java
As in JavaObject-Orientation with single inheritance
Interfaces
Exceptions
Threads
Packaging
Garbage Collection
Reflection
Dynamic loading of code
…
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 …
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()
Finally C# !!!!
Let’s start Coding and take a tour in Visual Studio..!
The Finest roadmap in application development
C#.NET Language Features
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
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…
OOP with C# Declaring classes Creating Object Inheritance
Sealed Classes, Interfaces Polymorphism
Overriding, Overloading Encapsulation
Properties Special Keywords
params, ref
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
Reference Types Vs Value Types
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
Exercise 3.0Create a struct for complex numbers.. Use operator overloading to implement the multiplication
Windows Programming in C#
Let’s create a simple Windows Based Client Application in C#.NET using Visual Studio..!