Introduction to .NET with C# @ university of wayamba
1. The choice of real engineers…
Prepared & Presented by :-
Prageeth Sandakalum, Microsoft Student Champ
2. Microsoft .NET Framework
What 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…
3. C# .NET Language
Access modifiers, Conditions, Loops
Object Oriented Programming in C#
Classes and Objects
Inheritance
Polymorphism
Encapsulation
Value Types Vs Reference Type
C# special language features
Enumerations, Nullable Types, Partial Classes, Operator
Overloading
Windows Forms
4. .NET ??
We have many. Why another 1?
.NET Framework (3.5)
All in 1 solution for a programmer…
5. 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 -
6. 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…
7. VB C++ C# J# … Secure, integrated class
libraries
Common Language Specification
Unifies programming
models across languages
Visual Studio .NET
ASP .NET
Windows
Web Forms Web Services Enables cross-language
Forms
Mobile Internet Toolkit
integration
ADO .NET and XML Factored for extensibility
Base Class Library Designed for tools
Create frameworks on top
Common Language Runtime of the high level .NET
framework
Operating System
ASP.NET Common Language Runtime
High-productivity environment Executes code, maintains
for building and running security, handles component
Web services “plumbing” and dependencies
8. 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!
9. 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.
10. As in Java
Object-Orientation with single inheritance
Interfaces
Exceptions
Threads
Packaging
Garbage Collection
Reflection
Dynamic loading of code
…
15. 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
16. Write 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…
18. Write 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.
Write a program to test the ref variable and the params
keyword
19.
20. 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
21. Create a struct for complex numbers.. Use operator
overloading to implement the multiplication
22. Let’s create a simple Windows
Based Client Application in
C#.NET using Visual Studio..!
23. Thank You !!!
Contact me for further clarification
Prageeth Sandakalum
Prageeth.itfac@live.com