Introduction to C#
 C# is a modern, general-purpose, object-oriented programming language .
 developed by Microsoft.
 Why C#?
 It is a modern, general-purpose programming language
 It is object oriented.
 It is easy to learn.
 It produces efficient programs.
 It can be compiled on a variety of computer platforms.
 It is a part of .Net Framework.
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
Features of C#
 Boolean Conditions
 Automatic Garbage Collection
 Standard Library
 Integration with Windows
 Simple Multithreading
 Easy-to-use Generics
 Conditional Compilation
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
C#-Environment
 .Net Framework
 Windows applications
 Web applications
 Web services
 IDEs
Visual Studio
Visual C# Express
Visual Web Developer
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
C#-Program Structure
 Namespace declaration
 One or multiple namespaces
 A class
 Class methods
 Class attributes
 A Main method()
 Statements and Expressions
 Comments (/* I’m a comment */ )
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
Important Points
 Case sensitive
 Statements ends with Semicolon(;)
 Execution starts at the main()
 Filename could be different than classname
 File extension .cs
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
Compiling and Executing the Program
 Using Visual Studio:
 Run button
 Shortcut F5
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
C#-Basic Syntax
 Member Variables
 Variables declared in a class
 Member Methods
 Methods declared in a class
 Instantiating a Class
 Make an object
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
Identifier
 An identifier is a name used to identify a class, variable, function, or any other user-defined item.
 Rules:
 Begins with letters followed by digits and underscore
 Not contain space $ special characters
 Not keywords
 E.g int length; int r_length int r22
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
C#-Keywords
 Keywords are reserved words predefined to the C# compiler.
 Examples
 Class
 Static
 Abstract
 True
 False
 Bool
 Case
 As
 etc
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022
C#-Data Types
 The variables in C#, are categorized into the following types:
 Value types
 Reference types
 Pointer types
Lecturer: Asadullah Eman Email: asademan.aez@gmail.com
2022

CSharp Programming.pptx

  • 1.
    Introduction to C# C# is a modern, general-purpose, object-oriented programming language .  developed by Microsoft.  Why C#?  It is a modern, general-purpose programming language  It is object oriented.  It is easy to learn.  It produces efficient programs.  It can be compiled on a variety of computer platforms.  It is a part of .Net Framework. Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 2.
    Features of C# Boolean Conditions  Automatic Garbage Collection  Standard Library  Integration with Windows  Simple Multithreading  Easy-to-use Generics  Conditional Compilation Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 3.
    C#-Environment  .Net Framework Windows applications  Web applications  Web services  IDEs Visual Studio Visual C# Express Visual Web Developer Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 4.
    C#-Program Structure  Namespacedeclaration  One or multiple namespaces  A class  Class methods  Class attributes  A Main method()  Statements and Expressions  Comments (/* I’m a comment */ ) Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 5.
    Important Points  Casesensitive  Statements ends with Semicolon(;)  Execution starts at the main()  Filename could be different than classname  File extension .cs Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 6.
    Compiling and Executingthe Program  Using Visual Studio:  Run button  Shortcut F5 Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 7.
    C#-Basic Syntax  MemberVariables  Variables declared in a class  Member Methods  Methods declared in a class  Instantiating a Class  Make an object Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 8.
    Identifier  An identifieris a name used to identify a class, variable, function, or any other user-defined item.  Rules:  Begins with letters followed by digits and underscore  Not contain space $ special characters  Not keywords  E.g int length; int r_length int r22 Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 9.
    C#-Keywords  Keywords arereserved words predefined to the C# compiler.  Examples  Class  Static  Abstract  True  False  Bool  Case  As  etc Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022
  • 10.
    C#-Data Types  Thevariables in C#, are categorized into the following types:  Value types  Reference types  Pointer types Lecturer: Asadullah Eman Email: asademan.aez@gmail.com 2022