SlideShare a Scribd company logo
Introduction to C# (CSharp).net
Brought to you by www.SiryMedia.in
• C# developed by Microsoft and comes after C, C++, Java. It
inherits the properties of C, C++, Java, VB.
• We can say C# is smart and intelligent sister of Java because it do
work smartly in compression to Java.
• The basic concept of C# language are same as C, C++ to whom
you have learnt in C, C++ tutorials.
• Launched in visual studio 2008
• Create a console with visual c# language
• It generates empty program class with main() method
• File extension in c#
• Project file extension: “.csproj” (Means c sharp project)
• Sample application development in C#
• Create a new “console application ” with “visual C#” language
• It generates an empty “program” class with “main()” method
• To run an application simply press f5 key on the keyboard. Then
the application will be executed and output will be displayed
Importing section
• This section contain importing statements that are used to
import (including or link) the .NET framework class library FCL.
• This is most similar to the include statement in c language
• Syntax: using namespace
• Note: if requires namespace is a member of another name space.
We have specify the parent and child namespaces separate with
“.” (dot).
• Ex: using system;
• Using system.io;
• Using system.data;
Namespace declaration:
• Here a user define namespace is to be declared
• Rule : In .NET applications, all the classes related to the
project should be declared in one namespace.
• Syntax: namespace namespacename{}
• Generally, the namespace name will be same as “project ”
name.
Class declaration
• This is to declare the startup class of the project.
• In every .NET application like console and windows
application. There should be a startup class name should
be “program” you cant change it
• A startup class is nothing a class, which contain main()
method.
• Syntax: class classname{}
Class
• Class is a data structure that contains data members (constants files,
events), member function methods, properties, constructor,
destructor, indexers and nested type. Basically :
• It is a user defined data type.
• It is a reference type.
• In fact class is a tag or template for object.
• Drawback of Class
• Class does not allocate memory to its data members & member
function itself. Basically memory is allocated through object of a class.
Class can’t explore itself means it can not access its members itself, to
access members of a class we use object of that class.
Object
• Object is representative of the class and is responsible for
memory allocation of its data members and member
functions.
• An object is a real world entity having attributes (data type)
and behaviors (functions).
Main() method
• As you know already in c/c++ languages. The main()
method is the starting execution point of the application
• When the application is executed the main method will be
executed first
• This method contains the main logic of the application
• Class program
• {
• static void
• Main(string[] args)
• {
• Console.writeline (“hello world!”);
• Console.readline();
• }
• }
• Compiling and running application:
• Compile: click on “build” menu – “build solution”.(or) press ctrl + shift + B
• Run:
• Click on “debug” menu – “start debugging” . (Or) press f5.
C#.net supports no of applications:
• 1.Console applications
• 2.OOPS
• 3.Class libraries
• 4.Window forms applications
• 5.Windows forms control library
• 6.Windows services
• 7.ado.net
• 8.mdi forms
• 9.gdi
• 10.multi threading
• 11.exception handling
• 12.linq
• 13.security
• 14.remoting
• 15.globalization &localization
• 16.crystal reports
• 17.setup & deployments
ex:
• using System;
• namespace ConsoleApplication1
• { class emp //class
• { int sal, bonus, ta, ts; //properties
• public void tsal() //method
• { sal = 10000;
• bonus = 5000;
• ta = 500;
• ts = sal + bonus + ta;
• Console.WriteLine("the total salary is:" + ts.ToString());
• Console.ReadLine();
• }
• static void Main(string[] args)
• { emp obj = new emp(); //instance
variable
• obj.tsal(); //calling
the method
• }
• }
• }
• // Namespace Declaration
• using System;
• // helper class
• class ClassA
• {
• string myString;
• // Constructor
• public ClassA(string str)
• {
• myString = str;
• }
• // Instance Method
• public void Show()
• {
• Console.WriteLine("{0}", myString);
• }
• // Destructor
• ~ClassA()
• {
• // Some resource cleanup routines
• }
• }
• // Program start class
• class ClassProgram
• {
• // Main begins program execution
• public static void Main()
• {
• // Instance of ClassA
• ClassA objA = new ClassA("Welcome to the world of C# language !!");
• // Call ClassA method
• objA.Show();
• }
• }
Platform Support
• I've put this last only because it doesn't appear to differentiate
these languages as much as you might think. All these languages
can run on multiple OS es and machine architectures. C is the
most widely-supported, then C++, and finally C# (although C# can
be used on most major platforms thanks to an open source
implementation called Mono).
• My experience of porting C++ programs between Windows and
various Unix flavors was unpleasant. I've never tried porting
anything very complex in C# to Mono, so I can't comment on
that.
For more understanding visit our c# program example
playlist in our channel SIRYMEDIA
Or
Click below links in description
Thank You
For more updates subscribe to our YouTube channel
SiryMedia
To watch more videos visit our website
www.sirymedia.in

More Related Content

What's hot (20)

PPTX
Asp.NET Validation controls
Guddu gupta
 
PPSX
C# - Part 1
Md. Mahedee Hasan
 
PPT
Java-java virtual machine
Surbhi Panhalkar
 
PPTX
C# language
Akanksha Shukla
 
PPTX
Introduction To C#
rahulsahay19
 
PPTX
object oriented Programming ppt
Nitesh Dubey
 
PPTX
Java swing
Apurbo Datta
 
PPSX
Strings in Java
Hitesh-Java
 
PDF
Java IO
UTSAB NEUPANE
 
PPT
Oops ppt
abhayjuneja
 
PPT
Java And Multithreading
Shraddha
 
PDF
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
PPTX
C++ Memory Management
Rahul Jamwal
 
PPT
Working with frames
myrajendra
 
PPT
Java non access modifiers
Srinivas Reddy
 
PPSX
Introduction of java
Madishetty Prathibha
 
PPTX
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
shamnasain
 
PPTX
Arrays in Java
Abhilash Nair
 
PPT
Sqlite
Kumar
 
PPTX
C sharp
sanjay joshi
 
Asp.NET Validation controls
Guddu gupta
 
C# - Part 1
Md. Mahedee Hasan
 
Java-java virtual machine
Surbhi Panhalkar
 
C# language
Akanksha Shukla
 
Introduction To C#
rahulsahay19
 
object oriented Programming ppt
Nitesh Dubey
 
Java swing
Apurbo Datta
 
Strings in Java
Hitesh-Java
 
Java IO
UTSAB NEUPANE
 
Oops ppt
abhayjuneja
 
Java And Multithreading
Shraddha
 
JavaScript - Chapter 15 - Debugging Techniques
WebStackAcademy
 
C++ Memory Management
Rahul Jamwal
 
Working with frames
myrajendra
 
Java non access modifiers
Srinivas Reddy
 
Introduction of java
Madishetty Prathibha
 
Java Virtual Machine (JVM), Difference JDK, JRE & JVM
shamnasain
 
Arrays in Java
Abhilash Nair
 
Sqlite
Kumar
 
C sharp
sanjay joshi
 

Viewers also liked (7)

PPTX
C Sharp Course 101.5
Shahed Chowdhuri
 
PPT
C sharp
Satish Verma
 
PPT
Introduction To C#
SAMIR BHOGAYTA
 
PDF
Visual Basic 6.0
MuralirajSanjeev
 
PPTX
Presentation on visual basic 6 (vb6)
pbarasia
 
PPT
Introduction to visual basic programming
Roger Argarin
 
PPT
Visual basic ppt for tutorials computer
simran153
 
C Sharp Course 101.5
Shahed Chowdhuri
 
C sharp
Satish Verma
 
Introduction To C#
SAMIR BHOGAYTA
 
Visual Basic 6.0
MuralirajSanjeev
 
Presentation on visual basic 6 (vb6)
pbarasia
 
Introduction to visual basic programming
Roger Argarin
 
Visual basic ppt for tutorials computer
simran153
 
Ad

Similar to introduction to c # (20)

PPTX
Csharp introduction
Sireesh K
 
PPT
ASP.NET Session 3
Sisir Ghosh
 
PDF
Intro to .NET and Core C#
Jussi Pohjolainen
 
PPTX
1 java programming- introduction
jyoti_lakhani
 
PPTX
CS4443 - Modern Programming Language - I Lecture (1)
Dilawar Khan
 
PPTX
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
PPTX
Presentation 1st
Connex
 
PPTX
iOS Application Exploitation
Positive Hack Days
 
PPTX
Java For beginners and CSIT and IT students
Partnered Health
 
PPTX
C# lecture 1: Introduction to Dot Net Framework
Dr.Neeraj Kumar Pandey
 
PDF
C++ Windows Forms L01 - Intro
Mohammad Shaker
 
PPTX
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
PPTX
Object oriented programming 7 first steps in oop using c++
Vaibhav Khanna
 
PPTX
C++ l 1
vineet_singh
 
PPT
JAVA INTRODUCTION
PUSHPA KUMAR
 
PPTX
C # (C Sharp).pptx
SnapeSever
 
PDF
ITFT - Java Coding
Blossom Sood
 
PPTX
Basics of C Lecture 2[16097].pptx
CoolGamer16
 
PPT
Jacarashed-1746968053-300050282-Java.ppt
DilipDas70
 
PPTX
object oriented programming unit one ppt
isiagnel2
 
Csharp introduction
Sireesh K
 
ASP.NET Session 3
Sisir Ghosh
 
Intro to .NET and Core C#
Jussi Pohjolainen
 
1 java programming- introduction
jyoti_lakhani
 
CS4443 - Modern Programming Language - I Lecture (1)
Dilawar Khan
 
C# .NET: Language Features and Creating .NET Projects, Namespaces Classes and...
yazad dumasia
 
Presentation 1st
Connex
 
iOS Application Exploitation
Positive Hack Days
 
Java For beginners and CSIT and IT students
Partnered Health
 
C# lecture 1: Introduction to Dot Net Framework
Dr.Neeraj Kumar Pandey
 
C++ Windows Forms L01 - Intro
Mohammad Shaker
 
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Jannat Ruma
 
Object oriented programming 7 first steps in oop using c++
Vaibhav Khanna
 
C++ l 1
vineet_singh
 
JAVA INTRODUCTION
PUSHPA KUMAR
 
C # (C Sharp).pptx
SnapeSever
 
ITFT - Java Coding
Blossom Sood
 
Basics of C Lecture 2[16097].pptx
CoolGamer16
 
Jacarashed-1746968053-300050282-Java.ppt
DilipDas70
 
object oriented programming unit one ppt
isiagnel2
 
Ad

More from Sireesh K (20)

PPTX
Cn10
Sireesh K
 
PPTX
chanakya neeti
Sireesh K
 
PPTX
chanakya neeti
Sireesh K
 
DOCX
What is mvc
Sireesh K
 
PPTX
31c
Sireesh K
 
PPTX
31cs
Sireesh K
 
PPTX
45c
Sireesh K
 
PPTX
44c
Sireesh K
 
PPTX
43c
Sireesh K
 
PPTX
42c
Sireesh K
 
PPTX
41c
Sireesh K
 
PPTX
40c
Sireesh K
 
PPTX
39c
Sireesh K
 
PPTX
38c
Sireesh K
 
PPTX
37c
Sireesh K
 
PPTX
35c
Sireesh K
 
PPTX
34c
Sireesh K
 
PPTX
33c
Sireesh K
 
PPTX
30c
Sireesh K
 
PPTX
29c
Sireesh K
 
Cn10
Sireesh K
 
chanakya neeti
Sireesh K
 
chanakya neeti
Sireesh K
 
What is mvc
Sireesh K
 
31cs
Sireesh K
 

Recently uploaded (20)

PPT
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PDF
Stepwise procedure (Manually Submitted & Un Attended) Medical Devices Cases
MUHAMMAD SOHAIL
 
PPTX
10CLA Term 3 Week 4 Study Techniques.pptx
mansk2
 
DOCX
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
PPTX
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
PPTX
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
PPTX
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
PPTX
Constitutional Design Civics Class 9.pptx
bikesh692
 
PPTX
THE JEHOVAH’S WITNESSES’ ENCRYPTED SATANIC CULT
Claude LaCombe
 
PDF
EXCRETION-STRUCTURE OF NEPHRON,URINE FORMATION
raviralanaresh2
 
PDF
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
PDF
Exploring-the-Investigative-World-of-Science.pdf/8th class curiosity/1st chap...
Sandeep Swamy
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
DRUGS USED IN THERAPY OF SHOCK, Shock Therapy, Treatment or management of shock
Rajshri Ghogare
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
CONCEPT OF CHILD CARE. pptx
AneetaSharma15
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Stepwise procedure (Manually Submitted & Un Attended) Medical Devices Cases
MUHAMMAD SOHAIL
 
10CLA Term 3 Week 4 Study Techniques.pptx
mansk2
 
Unit 5: Speech-language and swallowing disorders
JELLA VISHNU DURGA PRASAD
 
Unlock the Power of Cursor AI: MuleSoft Integrations
Veera Pallapu
 
LDP-2 UNIT 4 Presentation for practical.pptx
abhaypanchal2525
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 7-20-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Constitutional Design Civics Class 9.pptx
bikesh692
 
THE JEHOVAH’S WITNESSES’ ENCRYPTED SATANIC CULT
Claude LaCombe
 
EXCRETION-STRUCTURE OF NEPHRON,URINE FORMATION
raviralanaresh2
 
My Thoughts On Q&A- A Novel By Vikas Swarup
Niharika
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
Exploring-the-Investigative-World-of-Science.pdf/8th class curiosity/1st chap...
Sandeep Swamy
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 

introduction to c #

  • 1. Introduction to C# (CSharp).net Brought to you by www.SiryMedia.in
  • 2. • C# developed by Microsoft and comes after C, C++, Java. It inherits the properties of C, C++, Java, VB. • We can say C# is smart and intelligent sister of Java because it do work smartly in compression to Java. • The basic concept of C# language are same as C, C++ to whom you have learnt in C, C++ tutorials. • Launched in visual studio 2008 • Create a console with visual c# language • It generates empty program class with main() method
  • 3. • File extension in c# • Project file extension: “.csproj” (Means c sharp project) • Sample application development in C# • Create a new “console application ” with “visual C#” language • It generates an empty “program” class with “main()” method • To run an application simply press f5 key on the keyboard. Then the application will be executed and output will be displayed
  • 4. Importing section • This section contain importing statements that are used to import (including or link) the .NET framework class library FCL. • This is most similar to the include statement in c language • Syntax: using namespace • Note: if requires namespace is a member of another name space. We have specify the parent and child namespaces separate with “.” (dot). • Ex: using system; • Using system.io; • Using system.data;
  • 5. Namespace declaration: • Here a user define namespace is to be declared • Rule : In .NET applications, all the classes related to the project should be declared in one namespace. • Syntax: namespace namespacename{} • Generally, the namespace name will be same as “project ” name.
  • 6. Class declaration • This is to declare the startup class of the project. • In every .NET application like console and windows application. There should be a startup class name should be “program” you cant change it • A startup class is nothing a class, which contain main() method. • Syntax: class classname{}
  • 7. Class • Class is a data structure that contains data members (constants files, events), member function methods, properties, constructor, destructor, indexers and nested type. Basically : • It is a user defined data type. • It is a reference type. • In fact class is a tag or template for object. • Drawback of Class • Class does not allocate memory to its data members & member function itself. Basically memory is allocated through object of a class. Class can’t explore itself means it can not access its members itself, to access members of a class we use object of that class.
  • 8. Object • Object is representative of the class and is responsible for memory allocation of its data members and member functions. • An object is a real world entity having attributes (data type) and behaviors (functions).
  • 9. Main() method • As you know already in c/c++ languages. The main() method is the starting execution point of the application • When the application is executed the main method will be executed first • This method contains the main logic of the application
  • 10. • Class program • { • static void • Main(string[] args) • { • Console.writeline (“hello world!”); • Console.readline(); • } • } • Compiling and running application: • Compile: click on “build” menu – “build solution”.(or) press ctrl + shift + B • Run: • Click on “debug” menu – “start debugging” . (Or) press f5.
  • 11. C#.net supports no of applications: • 1.Console applications • 2.OOPS • 3.Class libraries • 4.Window forms applications • 5.Windows forms control library • 6.Windows services • 7.ado.net
  • 12. • 8.mdi forms • 9.gdi • 10.multi threading • 11.exception handling • 12.linq • 13.security • 14.remoting • 15.globalization &localization • 16.crystal reports • 17.setup & deployments
  • 13. ex: • using System; • namespace ConsoleApplication1 • { class emp //class • { int sal, bonus, ta, ts; //properties • public void tsal() //method • { sal = 10000; • bonus = 5000; • ta = 500; • ts = sal + bonus + ta; • Console.WriteLine("the total salary is:" + ts.ToString()); • Console.ReadLine(); • }
  • 14. • static void Main(string[] args) • { emp obj = new emp(); //instance variable • obj.tsal(); //calling the method • } • } • }
  • 15. • // Namespace Declaration • using System; • // helper class • class ClassA • { • string myString; • // Constructor • public ClassA(string str) • { • myString = str; • } • // Instance Method • public void Show() • { • Console.WriteLine("{0}", myString); • }
  • 16. • // Destructor • ~ClassA() • { • // Some resource cleanup routines • } • } • // Program start class • class ClassProgram • { • // Main begins program execution • public static void Main() • { • // Instance of ClassA • ClassA objA = new ClassA("Welcome to the world of C# language !!"); • // Call ClassA method • objA.Show(); • } • }
  • 17. Platform Support • I've put this last only because it doesn't appear to differentiate these languages as much as you might think. All these languages can run on multiple OS es and machine architectures. C is the most widely-supported, then C++, and finally C# (although C# can be used on most major platforms thanks to an open source implementation called Mono). • My experience of porting C++ programs between Windows and various Unix flavors was unpleasant. I've never tried porting anything very complex in C# to Mono, so I can't comment on that.
  • 18. For more understanding visit our c# program example playlist in our channel SIRYMEDIA Or Click below links in description
  • 19. Thank You For more updates subscribe to our YouTube channel SiryMedia To watch more videos visit our website www.sirymedia.in