SlideShare a Scribd company logo
1 of 36
C# language
Session -3
Objectives
1.Understanding of the language basics to facilitate
development.
2.Basic Object Oriented Programming concepts and
C# Programming Structure.
3. Language fundamentals
4.Doing our first C# Program.
5. Hands on knowledge in Visual Studio.
Introduction
• C# (pronounced “See Sharp”) is a simple, modern,
object-oriented programming language.
• It was made by Microsoft Corporation, more
precisely by Anders Hejlsberg.
• It was created to use all capacities of .NET
platform. The first version appeared in 2001, last
update appeared in 2010 with the C# 4.0.
• C# has its roots in the C family of languages and
will be immediately familiar to C, C++, and Java
programmers.
Fundamentals of Object Oriented
Programming
• OOPs design methodology is different from
traditional language like BASIC, Pascal, C etc.
Those are called the Procedural Language.
• In OOP, the emphasis is on Data and not on
procedures.
Class
• In OOP, A class describes all the attributes of
objects,as well as the methods that implement the
behavior of member object.
• A class is only a specification of a data type.
• A class is like a blue print of the Object.
Fundamentals of Object Oriented
Programming(Contd..)
Objects
• They are instance of classes.
• Objects are the central idea behind OOP
technology.
• An object is a bundle of variables and related
methods.
• When an object is created memory allocation
takes place.
Fundamentals of Object Oriented
Programming(Contd..)
Three principles of object oriented programming
1.Encapsulation
• The ability to hide the internals details of an object
from the outside world.
2.Inheritance
• Hierarchy is used to define more specialized classes
based on a preexisting generalized class.
3.Polymorphism
• The ability to extend functionality.
Abstract Class:
 We can not create a object of abstract class.
 It only allows other classes to inherit from it but can't
be instantiated.
 In C# we use Abstract Keyword.
Interface
 An interface is not a class, is entity.
 An interface has no implementation; it only has the
signature.
 Just the definition of the methods without the body.
Partial Class Example
• public partial class MyClass
• {
• partial void DoSomethingElse();
• public void DoSomething()
• {
Console.WriteLine("DoSomething() execution
started.");
• DoSomethingElse();
• Console.WriteLine("DoSomething() execution
finished.");
• Console.ReadKey();
• }
• }
• public partial class MyClass
• {
• partial void DoSomethingElse()
• {
• Console.WriteLine("DoSomethingElse()
called.");
• }
• }
• class Program
• {
•
• static void Main(string[] args)
• {
• MyClass mm = new MyClass();
• mm.DoSomething();
• }
• }
• }
OutPut
• DoSomething() execution started.
• DoSomethingElse() called.
• DoSomething() execution finished.
C# Language Fundamentals
• Garbage collection automatically reclaims
memory occupied by unused objects.
• Exception handling provides a structured and
extensible approach to error detection and
recovery.
• Ex: try, catch & finally
• C# is case-sensitive.
C# Console Application
• Console applications in C# have exactly the same purpose
as regular console applications: to provide a command line
interface with the user.
• Console applications have three main input streams:
standard in, standard out and standard error.
• “Hello World” Program using C#:
using System;
class Hello
{
static void Main(String[] args)
{
Console.WriteLine("Hello, World");
}
}
C# Console Application in Visual
Studio
C# Console Application(Contd..)
• The "System.Console" class:- The main element
in a console application is the "System.Console"
class. It contains all methods needed to control the
three streams of data.
• "ReadLine" method:- The main ways of
acquiring data from the standard input stream.
"ReadLine" reads a whole line of characters from
the buffer up to the point where the first end line
character ("n") is found. It outputs its data as
"string“.
Working with Visual Studio
• Microsoft Visual Studio is an Integrated Development
Environment (IDE) from Microsoft.
• It can be used to develop Console applications along
with Windows Forms applications, web sites, web
applications, and web services.
• Features :
1. Code editor
2. Debugger
3. Designer
4. Other Tools
Code editor
• Visual Studio includes a code editor that
supports syntax highlighting and code
completion using IntelliSense for not only
variables, functions and methods but also
language constructs like loops and queries.
• Autocomplete suggestions are popped up in a
modeless list box, overlaid on top of the code
editor.
Debugger
• Visual Studio includes a debugger that works both as a
source-level debugger and as a machine-level debugger.
• It works with both managed code as well as native code and
can be used for debugging applications written in any
language supported by Visual Studio.
• The debugger allows setting breakpoints (which allow
execution to be stopped temporarily at a certain position).
• The debugger supports Edit and Continue, i.e., it allows
code to be edited as it is being debugged (32 bit only; not
supported in 64 bit).
• When debugging, if the mouse pointer hovers over any
variable, its current value is displayed in a tooltip ("data
tooltips"), where it can also be modified if desired.
Designer
• Visual Studio includes a host of visual
designers to aid in the development of
applications. These tools include:
1. Windows Forms Designer
2. Web designer/development
3. Class designer
4. Data designer
Windows Forms Designer
• The Windows Forms designer is used to build GUI
applications using Windows Forms.
• It includes a palette of UI widgets and controls (including
buttons, progress bars, labels, layout containers and other
controls) that can be dragged and dropped on a form
surface.
• Layout can be controlled by housing the controls inside
other containers or locking them to the side of the form.
• Controls that display data (like textbox, list box, grid view,
etc.) can be data-bound to data sources like databases or
queries.
• The designer generates either C# or VB.NET code for the
application.
Web designer/development
• Visual Studio also includes a web-site editor
and designer that allows web pages to be
authored by dragging and dropping Web
controls.
• It is used for developing ASP.NET
applications and supports HTML, CSS and
JavaScript.
• It uses a code-behind model to link with
ASP.NET code.
Class designer
• The Class Designer is used to author and edit
the classes.
• The Class Designer can generate C# and
VB.NET code outlines for the classes and
methods.
• It can also generate class diagrams from hand-
written classes.
Data designer
• The data designer can be used to graphically
edit typed database tables, primary and foreign
keys and constraints.
• It can also be used to design queries from the
graphical view.
Polymorphism in .Net
• What is Polymorphism?
Polymorphism means same operation may
behave differently on different classes.
Example of Compile Time Polymorphism:
Method Overloading
Example of Run Time Polymorphism: Method
Overriding
Example of Compile Time
Polymorphism
Method Overloading
- Method with same name but with different arguments is
called method overloading.
- Method Overloading forms compile-time polymorphism.
- Example of Method Overloading:
class A1
{
void hello()
{ Console.WriteLine(“Hello”); }
void hello(string s)
{ Console.WriteLine(“Hello {0}”,s); }
}
Run Time Polymorphism
• Method Overriding
- Method overriding occurs when child class declares
a method that has the same type arguments as a
method declared by one of its superclass.
- Method overriding forms Run-time polymorphism.
- Note: By default functions are not virtual in C# and
so you need to write “virtual” explicitly. While by
default in Java each function are virtual.
- Example of Method Overriding:
• Class parent
{
virtual void hello()
{ Console.WriteLine(“Hello from Parent”); }
}
Class child : parent
{
override void hello()
{ Console.WriteLine(“Hello from Child”); }
}
static void main()
{
parent objParent = new child();
objParent.hello();
}
//Output
Hello from Child.
•
Summery
Language basics to facilitate development.
Basic Object Oriented Programming concepts
C# Programming Structure.
Language fundamentals
Doing our first C# Program.
Hands on knowledge in Visual Studio.

More Related Content

What's hot

Introduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayambaIntroduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayamba
Prageeth Sandakalum
 
The .NET Platform - A Brief Overview
The .NET Platform - A Brief OverviewThe .NET Platform - A Brief Overview
The .NET Platform - A Brief Overview
Carlos Lopes
 

What's hot (20)

Introduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayambaIntroduction to .NET with C# @ university of wayamba
Introduction to .NET with C# @ university of wayamba
 
C sharp
C sharpC sharp
C sharp
 
.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti.Net framework components by naveen kumar veligeti
.Net framework components by naveen kumar veligeti
 
Architecture in .net
Architecture in .netArchitecture in .net
Architecture in .net
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
.Net framework architecture
.Net framework architecture.Net framework architecture
.Net framework architecture
 
Visual Studio.NET
Visual Studio.NETVisual Studio.NET
Visual Studio.NET
 
Architecture of .net framework
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
 
Dotnet Frameworks Version History
Dotnet Frameworks Version HistoryDotnet Frameworks Version History
Dotnet Frameworks Version History
 
C#.NET
C#.NETC#.NET
C#.NET
 
Introduction to .net framework
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
 
VB.NET:An introduction to Namespaces in .NET framework
VB.NET:An introduction to  Namespaces in .NET frameworkVB.NET:An introduction to  Namespaces in .NET framework
VB.NET:An introduction to Namespaces in .NET framework
 
.Net introduction
.Net introduction.Net introduction
.Net introduction
 
dot net technology
dot net technologydot net technology
dot net technology
 
The .NET Platform - A Brief Overview
The .NET Platform - A Brief OverviewThe .NET Platform - A Brief Overview
The .NET Platform - A Brief Overview
 
C Sharp Course 101.5
C Sharp Course 101.5C Sharp Course 101.5
C Sharp Course 101.5
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)Module 1: Introduction to .NET Framework 3.5 (Slides)
Module 1: Introduction to .NET Framework 3.5 (Slides)
 
ASP.NET 01 - Introduction
ASP.NET 01 - IntroductionASP.NET 01 - Introduction
ASP.NET 01 - Introduction
 
Working in Visual Studio.Net
Working in Visual Studio.NetWorking in Visual Studio.Net
Working in Visual Studio.Net
 

Viewers also liked

android sqlite
android sqliteandroid sqlite
android sqlite
Deepa Rani
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
WE-IT TUTORIALS
 

Viewers also liked (16)

Chapter ii c#(building a user interface)
Chapter ii c#(building a user interface)Chapter ii c#(building a user interface)
Chapter ii c#(building a user interface)
 
Vara Framework
Vara FrameworkVara Framework
Vara Framework
 
04 gui 05
04 gui 0504 gui 05
04 gui 05
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Introducation to C#
Introducation to C#Introducation to C#
Introducation to C#
 
Sdi & mdi
Sdi & mdiSdi & mdi
Sdi & mdi
 
Sqlite
SqliteSqlite
Sqlite
 
android sqlite
android sqliteandroid sqlite
android sqlite
 
SQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management SystemSQLite: Light, Open Source Relational Database Management System
SQLite: Light, Open Source Relational Database Management System
 
SQLite - Overview
SQLite - OverviewSQLite - Overview
SQLite - Overview
 
How to create rss feed
How to create rss feedHow to create rss feed
How to create rss feed
 
how to setup Google analytics tracking code for website
how to setup  Google analytics tracking code for websitehow to setup  Google analytics tracking code for website
how to setup Google analytics tracking code for website
 
tybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notestybsc it asp.net full unit 1,2,3,4,5,6 notes
tybsc it asp.net full unit 1,2,3,4,5,6 notes
 
C#/.NET Little Wonders
C#/.NET Little WondersC#/.NET Little Wonders
C#/.NET Little Wonders
 
C# Tutorial
C# Tutorial C# Tutorial
C# Tutorial
 
Programming in c#
Programming in c#Programming in c#
Programming in c#
 

Similar to ASP.NET Session 3

Csc153 chapter 01
Csc153 chapter 01Csc153 chapter 01
Csc153 chapter 01
PCC
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
rchakra
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptx
fatahozil
 

Similar to ASP.NET Session 3 (20)

introduction to c #
introduction to c #introduction to c #
introduction to c #
 
Intro to .NET and Core C#
Intro to .NET and Core C#Intro to .NET and Core C#
Intro to .NET and Core C#
 
CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)CS4443 - Modern Programming Language - I Lecture (1)
CS4443 - Modern Programming Language - I Lecture (1)
 
C# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net FrameworkC# lecture 1: Introduction to Dot Net Framework
C# lecture 1: Introduction to Dot Net Framework
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)
 
Csc153 chapter 01
Csc153 chapter 01Csc153 chapter 01
Csc153 chapter 01
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & Architecture
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
 
Cs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ reportCs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ report
 
C# Fundamental
C# FundamentalC# Fundamental
C# Fundamental
 
C++ l 1
C++ l 1C++ l 1
C++ l 1
 
Computer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptxComputer and multimedia Week 1 Windows Architecture.pptx
Computer and multimedia Week 1 Windows Architecture.pptx
 
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
21UCAC61 C# and .Net Programming.pdf(MTNC)(BCA)
 
C_Programming_Notes_ICE
C_Programming_Notes_ICEC_Programming_Notes_ICE
C_Programming_Notes_ICE
 
Unit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptxUnit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptx
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - Intro
 
c# usage,applications and advantages
c# usage,applications and advantages c# usage,applications and advantages
c# usage,applications and advantages
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
iOS Application Exploitation
iOS Application ExploitationiOS Application Exploitation
iOS Application Exploitation
 
01. introduction to-programming
01. introduction to-programming01. introduction to-programming
01. introduction to-programming
 

More from Sisir Ghosh

ASP.NET Session 5
ASP.NET Session 5ASP.NET Session 5
ASP.NET Session 5
Sisir Ghosh
 
ASP.NET Session 6
ASP.NET Session 6ASP.NET Session 6
ASP.NET Session 6
Sisir Ghosh
 
ASP.NET Session 7
ASP.NET Session 7ASP.NET Session 7
ASP.NET Session 7
Sisir Ghosh
 
ASP.NET Session 8
ASP.NET Session 8ASP.NET Session 8
ASP.NET Session 8
Sisir Ghosh
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
Sisir Ghosh
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10
Sisir Ghosh
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
Sisir Ghosh
 
ASP.NET Session 13 14
ASP.NET Session 13 14ASP.NET Session 13 14
ASP.NET Session 13 14
Sisir Ghosh
 
ASP.NET Session 16
ASP.NET Session 16ASP.NET Session 16
ASP.NET Session 16
Sisir Ghosh
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2
Sisir Ghosh
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
Sisir Ghosh
 
Network security
Network securityNetwork security
Network security
Sisir Ghosh
 
Module ii physical layer
Module ii physical layerModule ii physical layer
Module ii physical layer
Sisir Ghosh
 
Error detection and correction
Error detection and correctionError detection and correction
Error detection and correction
Sisir Ghosh
 
Overview of data communication and networking
Overview of data communication and networkingOverview of data communication and networking
Overview of data communication and networking
Sisir Ghosh
 
Application layer
Application layerApplication layer
Application layer
Sisir Ghosh
 

More from Sisir Ghosh (18)

ASP.NET Session 5
ASP.NET Session 5ASP.NET Session 5
ASP.NET Session 5
 
ASP.NET Session 6
ASP.NET Session 6ASP.NET Session 6
ASP.NET Session 6
 
ASP.NET Session 7
ASP.NET Session 7ASP.NET Session 7
ASP.NET Session 7
 
ASP.NET Session 8
ASP.NET Session 8ASP.NET Session 8
ASP.NET Session 8
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10
 
ASP.NET Session 11 12
ASP.NET Session 11 12ASP.NET Session 11 12
ASP.NET Session 11 12
 
ASP.NET Session 13 14
ASP.NET Session 13 14ASP.NET Session 13 14
ASP.NET Session 13 14
 
ASP.NET Session 16
ASP.NET Session 16ASP.NET Session 16
ASP.NET Session 16
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2
 
ASP.NET Session 1
ASP.NET Session 1ASP.NET Session 1
ASP.NET Session 1
 
Transport layer
Transport layerTransport layer
Transport layer
 
Routing
RoutingRouting
Routing
 
Network security
Network securityNetwork security
Network security
 
Module ii physical layer
Module ii physical layerModule ii physical layer
Module ii physical layer
 
Error detection and correction
Error detection and correctionError detection and correction
Error detection and correction
 
Overview of data communication and networking
Overview of data communication and networkingOverview of data communication and networking
Overview of data communication and networking
 
Application layer
Application layerApplication layer
Application layer
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

ASP.NET Session 3

  • 2. Objectives 1.Understanding of the language basics to facilitate development. 2.Basic Object Oriented Programming concepts and C# Programming Structure. 3. Language fundamentals 4.Doing our first C# Program. 5. Hands on knowledge in Visual Studio.
  • 3. Introduction • C# (pronounced “See Sharp”) is a simple, modern, object-oriented programming language. • It was made by Microsoft Corporation, more precisely by Anders Hejlsberg. • It was created to use all capacities of .NET platform. The first version appeared in 2001, last update appeared in 2010 with the C# 4.0. • C# has its roots in the C family of languages and will be immediately familiar to C, C++, and Java programmers.
  • 4. Fundamentals of Object Oriented Programming • OOPs design methodology is different from traditional language like BASIC, Pascal, C etc. Those are called the Procedural Language. • In OOP, the emphasis is on Data and not on procedures. Class • In OOP, A class describes all the attributes of objects,as well as the methods that implement the behavior of member object. • A class is only a specification of a data type. • A class is like a blue print of the Object.
  • 5. Fundamentals of Object Oriented Programming(Contd..) Objects • They are instance of classes. • Objects are the central idea behind OOP technology. • An object is a bundle of variables and related methods. • When an object is created memory allocation takes place.
  • 6. Fundamentals of Object Oriented Programming(Contd..) Three principles of object oriented programming 1.Encapsulation • The ability to hide the internals details of an object from the outside world. 2.Inheritance • Hierarchy is used to define more specialized classes based on a preexisting generalized class. 3.Polymorphism • The ability to extend functionality.
  • 7. Abstract Class:  We can not create a object of abstract class.  It only allows other classes to inherit from it but can't be instantiated.  In C# we use Abstract Keyword. Interface  An interface is not a class, is entity.  An interface has no implementation; it only has the signature.  Just the definition of the methods without the body.
  • 8. Partial Class Example • public partial class MyClass • { • partial void DoSomethingElse(); • public void DoSomething() • { Console.WriteLine("DoSomething() execution started."); • DoSomethingElse(); • Console.WriteLine("DoSomething() execution finished.");
  • 9. • Console.ReadKey(); • } • } • public partial class MyClass • { • partial void DoSomethingElse() • { • Console.WriteLine("DoSomethingElse() called."); • } • }
  • 10. • class Program • { • • static void Main(string[] args) • { • MyClass mm = new MyClass(); • mm.DoSomething(); • } • } • }
  • 11. OutPut • DoSomething() execution started. • DoSomethingElse() called. • DoSomething() execution finished.
  • 12. C# Language Fundamentals • Garbage collection automatically reclaims memory occupied by unused objects. • Exception handling provides a structured and extensible approach to error detection and recovery. • Ex: try, catch & finally • C# is case-sensitive.
  • 13. C# Console Application • Console applications in C# have exactly the same purpose as regular console applications: to provide a command line interface with the user. • Console applications have three main input streams: standard in, standard out and standard error. • “Hello World” Program using C#: using System; class Hello { static void Main(String[] args) { Console.WriteLine("Hello, World"); } }
  • 14. C# Console Application in Visual Studio
  • 15. C# Console Application(Contd..) • The "System.Console" class:- The main element in a console application is the "System.Console" class. It contains all methods needed to control the three streams of data. • "ReadLine" method:- The main ways of acquiring data from the standard input stream. "ReadLine" reads a whole line of characters from the buffer up to the point where the first end line character ("n") is found. It outputs its data as "string“.
  • 16. Working with Visual Studio • Microsoft Visual Studio is an Integrated Development Environment (IDE) from Microsoft. • It can be used to develop Console applications along with Windows Forms applications, web sites, web applications, and web services. • Features : 1. Code editor 2. Debugger 3. Designer 4. Other Tools
  • 17. Code editor • Visual Studio includes a code editor that supports syntax highlighting and code completion using IntelliSense for not only variables, functions and methods but also language constructs like loops and queries. • Autocomplete suggestions are popped up in a modeless list box, overlaid on top of the code editor.
  • 18.
  • 19. Debugger • Visual Studio includes a debugger that works both as a source-level debugger and as a machine-level debugger. • It works with both managed code as well as native code and can be used for debugging applications written in any language supported by Visual Studio. • The debugger allows setting breakpoints (which allow execution to be stopped temporarily at a certain position). • The debugger supports Edit and Continue, i.e., it allows code to be edited as it is being debugged (32 bit only; not supported in 64 bit). • When debugging, if the mouse pointer hovers over any variable, its current value is displayed in a tooltip ("data tooltips"), where it can also be modified if desired.
  • 20.
  • 21. Designer • Visual Studio includes a host of visual designers to aid in the development of applications. These tools include: 1. Windows Forms Designer 2. Web designer/development 3. Class designer 4. Data designer
  • 22. Windows Forms Designer • The Windows Forms designer is used to build GUI applications using Windows Forms. • It includes a palette of UI widgets and controls (including buttons, progress bars, labels, layout containers and other controls) that can be dragged and dropped on a form surface. • Layout can be controlled by housing the controls inside other containers or locking them to the side of the form. • Controls that display data (like textbox, list box, grid view, etc.) can be data-bound to data sources like databases or queries. • The designer generates either C# or VB.NET code for the application.
  • 23.
  • 24. Web designer/development • Visual Studio also includes a web-site editor and designer that allows web pages to be authored by dragging and dropping Web controls. • It is used for developing ASP.NET applications and supports HTML, CSS and JavaScript. • It uses a code-behind model to link with ASP.NET code.
  • 25.
  • 26. Class designer • The Class Designer is used to author and edit the classes. • The Class Designer can generate C# and VB.NET code outlines for the classes and methods. • It can also generate class diagrams from hand- written classes.
  • 27.
  • 28. Data designer • The data designer can be used to graphically edit typed database tables, primary and foreign keys and constraints. • It can also be used to design queries from the graphical view.
  • 29.
  • 30.
  • 31.
  • 32. Polymorphism in .Net • What is Polymorphism? Polymorphism means same operation may behave differently on different classes. Example of Compile Time Polymorphism: Method Overloading Example of Run Time Polymorphism: Method Overriding
  • 33. Example of Compile Time Polymorphism Method Overloading - Method with same name but with different arguments is called method overloading. - Method Overloading forms compile-time polymorphism. - Example of Method Overloading: class A1 { void hello() { Console.WriteLine(“Hello”); } void hello(string s) { Console.WriteLine(“Hello {0}”,s); } }
  • 34. Run Time Polymorphism • Method Overriding - Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass. - Method overriding forms Run-time polymorphism. - Note: By default functions are not virtual in C# and so you need to write “virtual” explicitly. While by default in Java each function are virtual. - Example of Method Overriding:
  • 35. • Class parent { virtual void hello() { Console.WriteLine(“Hello from Parent”); } } Class child : parent { override void hello() { Console.WriteLine(“Hello from Child”); } } static void main() { parent objParent = new child(); objParent.hello(); } //Output Hello from Child. •
  • 36. Summery Language basics to facilitate development. Basic Object Oriented Programming concepts C# Programming Structure. Language fundamentals Doing our first C# Program. Hands on knowledge in Visual Studio.

Editor's Notes

  1. To use this concept in OOP we derived the idea of Class and Object.
  2. Encapsulation: Also termed as Information hiding , is the ability to hide the internals of an object from its users and also to provide an interface to only those members which you want the client to manipulate. Inheritance : Specification of relationship of one class with another class. A derived class is the new class being created and the base class is the one from which it is derived . Polymorphism : Its is the functionality that allows old code to call new code. Allows you to extend or enhance your system without having to modify old code.