SlideShare a Scribd company logo
Introduction to C#
/*ENTER PROPERTIES HERE MAIN (ARGUMENTS) { ENTER STUFF HERE }*/
Made by Arham Abbas
How to be a Programmer
Essentials:
• A Computer
• An OS
• An IDE
• You.
Requisites:
• Visual Studios 2015 or below.
• A problem solving brain
• Music or other ambience cancelling approaches
• An Internet connection
Pre-Requisites
Past programming experience
C# is…..
• A programming language with multiple paradigms .
• A high level language.
• A simple, modern, general-purpose, portable and robust language.
• A pretty cool tool to use.
Lets explain:
Your first Program
Hello World
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class FirstProgram
{
static void Main(string[] args)
{
string intro = "Hello ZUdin!!";
Console.WriteLine(intro);
Console.ReadKey();
}
}
}
There is a history why this is made to be the first program!
• using – Implementing another namespace into
your created namespace.
• namespace – a collection of classes.
• class - A collection of methods and expressions.
• Main – The function which acts as the entry point
for the program.
Data Types
These are the basic blocks which you will operate on
to create results.
The following are a few data types:
1. Integer
2. Float
3. Decimal
4. Long
5. Short
6. Byte
7. Char
8. String
9. Boolean
Advanced
10. Arrays
11. Dictionary
12. List
13. Object
14. Dynamic
15. Pointer
16. Null
Numerical – int, float, decimal, long, short, byte
Alphanumerial – char, string
Boolean – Boolean
Advanced –
i. Arrays – Either Numerical, Alphabetic or
Boolean.
ii. Dictionary – Either Numerical, Alpha or
Boolean
iii. List – Either Numeric, Alphabetic or Boolean.
iv. Object – Base type for all data types.
v. Dynamic – Any type. Bypassing the static field
vi. Pointer – Points at a reference object.
Operators
Perform operations on variables.
• Every function or method is a custom
operation.
• Basic mathematical operations
• + : Addition
• - : Subtraction
• / : Division
• * : Multiplication
• == : Equality
• != : Inequality
• <= : Greater than and equal to
• >= : Lesser than and equal to
• += : Add variable to self
• -= : Subtract variable from self
• ++ : Add 1 to self
• -- : Subtract 1 from self
• ! : NOT
• && : AND
• || : OR
• Advanced Operations
• Math.<Insert function name here>
• Other in-built functions
• Custom Functions
The little essentials
Comments:
Use them often for your future self’s sanity + others.
// This is for single line comments
/* We are
*Legion
* And we are a single unit.
This is a multi line comment*/
White Space:
This shows the user and the computer (sometimes) that
this part of the program is another function or method.
Whitespace can be created by the Tab key or 4
Spaces.
Whitespace methods modify space and
newline characters. Advanced uses for File
I/O might be taught in the course.
The curly bracket:
Used to define sections of the code.
Strongly coded language.
Each function, class and namespace has to be
followed by an opening and closing curly
bracket.
The semicolon:
Used to differentiate between lines of code.
Strongly coded syntax.
Functions: Ins and Outs
Functions are basically your custom operations within a class. Thus these operations can have inputted values in them
and they can output values to the calling method or statement.
private object SendAndReturn(int[] numbers, int num, etc.)
{
return objectvariable;
}
Data Type of the variable
which is returned via the
return statement in the
method/function.
Return Statement
followed by a
variable which has
type object.
Variables which are feeded into the
function/method. Can be as many as
possible. The data type is stated for
each variable in the function instance.
When calling, only the variable name is
written.
Functions
The MAIN function:
• This is the GOTO function for the compiler.
• The program starts and ends on this function.
• All other methods are sub-routines for this function.
• This function should be as small as possible for ease of debugging.
Custom functions:
• Called by the MAIN function.
• Values can be passed onto them and can be returned from them. (Single or multiple)
• Variables inside methods cannot be used outside them. They are only present when the method is called and
deleted when it ends.
• Can call other functions but cannot call on the MAIN function.
Access Modifiers
Static
A static function, unlike a regular (instance) function, is not associated with an instance of the class.
A static class is a class which can only contain static members, and therefore cannot be instantiated.
For example:
class SomeClass {
public int InstanceMethod() { return 1; }
public static int StaticMethod() { return 42; }
}
In order to call InstanceMethod, you need an instance of the class:
SomeClass instance = new SomeClass();
instance.InstanceMethod(); //Fine
instance.StaticMethod(); //Won't compile
SomeClass.InstanceMethod(); //Won't compile
SomeClass.StaticMethod(); //Fine
Loops and
Conditional
Statements
CODING IS DANGEROUS ,SO TAKE
THESE WITH YOU.
Iterating Codes
Writing the same code again and again is bad practice and is looked down on.
This is due to the following reasons:
1. Extra Lines of code makes it harder to navigate the code.
2. More Lines, More Errors.
3. Harder to understand .
4. Alternative are better.
Functions:
1. For Loop
2. For Each
3. While Loop
4. Do While
5. If Else Statement
6. Switch Statement
For this till here, do that.
for (int count = 0; count < 100; count++)
{
<Insert your Code here>
}
A normal incrementing for loop
There are several types of for loop variations.
These are some of them:
1. Incrementing
2. Decrement
3. Increment, step
4. Decrement, step
5. Function
6. Char
Looping inside a loop inside a loop and on and on. You can
have nigh endless amounts of them but what are you going
to use them for??
A normal 3 loop example would be going through all the
cells of a 3D array. Visualizing a 3D object would be easy
but what would happen when you start thinking about a 4D
object or more.
For Loops
for (int count = 0; count < 100; count++)
{
<Insert your Code here>
}
There are 3 statements in the for loop function which makes it
unique.
1. The first one initializes a variable or uses a variable or your
making. Here we initialize a variable called count which is
an int type with the value of 0
2. The second statement gives the compiler a condition where
the loop would end. Over here, we want it to run till the
point where it has reached 100 and it stops at 100.
3. The third statement tells the compiler that the variable
count will increase its value by 1 every step.
A FOR loop has certain condition where it has its
advantages and disadvantages. These are some:
1. All loops work with strings and char type but
a FOR loop is preferred for its syntax and
index variable.
2. It is often the fastest way to loop over large
sets of numbers. It is easy for the compiler to
optimize.
3. Nesting loops inside is confusing.
4. Optimization requires quite a lot of
brainstorming because faster methods are
not as simple as using a for loop.

More Related Content

PPTX
Full Python in 20 slides
PPTX
OCP Java (OCPJP) 8 Exam Quick Reference Card
PDF
Java8 features
PPTX
java 8 new features
PDF
Eclipse and Java 8 - Eclipse Day India 2013
PDF
Command line-arguments-in-java-tutorial
PPT
Intro To Scala
PPTX
Java 8 new features
Full Python in 20 slides
OCP Java (OCPJP) 8 Exam Quick Reference Card
Java8 features
java 8 new features
Eclipse and Java 8 - Eclipse Day India 2013
Command line-arguments-in-java-tutorial
Intro To Scala
Java 8 new features

What's hot (19)

PPTX
java in Aartificial intelligent by virat andodariya
PPTX
Functions in Python
PDF
JDT Embraces Lambda Expressions - EclipseCon North America 2014
PDF
Functional programming with Java 8
PPTX
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
PPTX
Functional programming principles and Java 8
PPTX
2CPP08 - Overloading and Overriding
PPTX
Command Line Arguments in C#
PPT
Command line arguments.21
PPT
Java findamentals1
PPT
Java findamentals1
PPT
Java findamentals1
PDF
Preparing for Scala 3
PDF
Functional Programming in Java
PDF
Functional programming in scala
PPT
Intro. to prog. c++
PDF
Cracking OCA and OCP Java 8 Exams
PPTX
What To Leave Implicit
PDF
Xtend - better java with -less- noise
java in Aartificial intelligent by virat andodariya
Functions in Python
JDT Embraces Lambda Expressions - EclipseCon North America 2014
Functional programming with Java 8
OCA Java SE 8 Exam Chapter 1 Java Building Blocks
Functional programming principles and Java 8
2CPP08 - Overloading and Overriding
Command Line Arguments in C#
Command line arguments.21
Java findamentals1
Java findamentals1
Java findamentals1
Preparing for Scala 3
Functional Programming in Java
Functional programming in scala
Intro. to prog. c++
Cracking OCA and OCP Java 8 Exams
What To Leave Implicit
Xtend - better java with -less- noise
Ad

Similar to Introduction to c first week slides (20)

PPTX
C# basics
DOCX
C# language basics (Visual Studio)
DOCX
C# language basics (Visual studio)
PPTX
How To Code in C#
PPT
Visula C# Programming Lecture 2
PPT
PPT
For Beginners - C#
PPTX
Chapter3: fundamental programming
PPTX
CS4443 - Modern Programming Language - I Lecture (2)
PDF
C sharp chap2
PPTX
PPTX
CSharp Language Overview Part 1
PDF
Basic c# cheat sheet
PPTX
PPTX
Introduction to C#
PPTX
Cordovilla
PDF
The C Player s Guide 3rd Edition Rb Whitaker
PDF
The C Player s Guide 3rd Edition Rb Whitaker
PPSX
DISE - Windows Based Application Development in C#
PPTX
Notes(1).pptx
C# basics
C# language basics (Visual Studio)
C# language basics (Visual studio)
How To Code in C#
Visula C# Programming Lecture 2
For Beginners - C#
Chapter3: fundamental programming
CS4443 - Modern Programming Language - I Lecture (2)
C sharp chap2
CSharp Language Overview Part 1
Basic c# cheat sheet
Introduction to C#
Cordovilla
The C Player s Guide 3rd Edition Rb Whitaker
The C Player s Guide 3rd Edition Rb Whitaker
DISE - Windows Based Application Development in C#
Notes(1).pptx
Ad

More from luqman bawany (6)

PDF
Sensors
DOCX
Random number generator based game
PPTX
CHOMSKEY'S UNIVERSAL GRAMMAR
PDF
Peizometer sensor
PPT
Self esteem
PPT
7Cs of COMMUNICATION
Sensors
Random number generator based game
CHOMSKEY'S UNIVERSAL GRAMMAR
Peizometer sensor
Self esteem
7Cs of COMMUNICATION

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
GDM (1) (1).pptx small presentation for students
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Cell Structure & Organelles in detailed.
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Microbial disease of the cardiovascular and lymphatic systems
VCE English Exam - Section C Student Revision Booklet
GDM (1) (1).pptx small presentation for students
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Microbial diseases, their pathogenesis and prophylaxis
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Complications of Minimal Access Surgery at WLH
Supply Chain Operations Speaking Notes -ICLT Program
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
2.FourierTransform-ShortQuestionswithAnswers.pdf
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS

Introduction to c first week slides

  • 1. Introduction to C# /*ENTER PROPERTIES HERE MAIN (ARGUMENTS) { ENTER STUFF HERE }*/ Made by Arham Abbas
  • 2. How to be a Programmer Essentials: • A Computer • An OS • An IDE • You. Requisites: • Visual Studios 2015 or below. • A problem solving brain • Music or other ambience cancelling approaches • An Internet connection Pre-Requisites Past programming experience
  • 3. C# is….. • A programming language with multiple paradigms . • A high level language. • A simple, modern, general-purpose, portable and robust language. • A pretty cool tool to use.
  • 5. Your first Program Hello World using System; using System.Collections.Generic; namespace ConsoleApplication1 { class FirstProgram { static void Main(string[] args) { string intro = "Hello ZUdin!!"; Console.WriteLine(intro); Console.ReadKey(); } } } There is a history why this is made to be the first program! • using – Implementing another namespace into your created namespace. • namespace – a collection of classes. • class - A collection of methods and expressions. • Main – The function which acts as the entry point for the program.
  • 6. Data Types These are the basic blocks which you will operate on to create results. The following are a few data types: 1. Integer 2. Float 3. Decimal 4. Long 5. Short 6. Byte 7. Char 8. String 9. Boolean Advanced 10. Arrays 11. Dictionary 12. List 13. Object 14. Dynamic 15. Pointer 16. Null Numerical – int, float, decimal, long, short, byte Alphanumerial – char, string Boolean – Boolean Advanced – i. Arrays – Either Numerical, Alphabetic or Boolean. ii. Dictionary – Either Numerical, Alpha or Boolean iii. List – Either Numeric, Alphabetic or Boolean. iv. Object – Base type for all data types. v. Dynamic – Any type. Bypassing the static field vi. Pointer – Points at a reference object.
  • 7. Operators Perform operations on variables. • Every function or method is a custom operation. • Basic mathematical operations • + : Addition • - : Subtraction • / : Division • * : Multiplication • == : Equality • != : Inequality • <= : Greater than and equal to • >= : Lesser than and equal to • += : Add variable to self • -= : Subtract variable from self • ++ : Add 1 to self • -- : Subtract 1 from self • ! : NOT • && : AND • || : OR • Advanced Operations • Math.<Insert function name here> • Other in-built functions • Custom Functions
  • 8. The little essentials Comments: Use them often for your future self’s sanity + others. // This is for single line comments /* We are *Legion * And we are a single unit. This is a multi line comment*/ White Space: This shows the user and the computer (sometimes) that this part of the program is another function or method. Whitespace can be created by the Tab key or 4 Spaces. Whitespace methods modify space and newline characters. Advanced uses for File I/O might be taught in the course. The curly bracket: Used to define sections of the code. Strongly coded language. Each function, class and namespace has to be followed by an opening and closing curly bracket. The semicolon: Used to differentiate between lines of code. Strongly coded syntax.
  • 9. Functions: Ins and Outs Functions are basically your custom operations within a class. Thus these operations can have inputted values in them and they can output values to the calling method or statement. private object SendAndReturn(int[] numbers, int num, etc.) { return objectvariable; } Data Type of the variable which is returned via the return statement in the method/function. Return Statement followed by a variable which has type object. Variables which are feeded into the function/method. Can be as many as possible. The data type is stated for each variable in the function instance. When calling, only the variable name is written.
  • 10. Functions The MAIN function: • This is the GOTO function for the compiler. • The program starts and ends on this function. • All other methods are sub-routines for this function. • This function should be as small as possible for ease of debugging. Custom functions: • Called by the MAIN function. • Values can be passed onto them and can be returned from them. (Single or multiple) • Variables inside methods cannot be used outside them. They are only present when the method is called and deleted when it ends. • Can call other functions but cannot call on the MAIN function.
  • 12. Static A static function, unlike a regular (instance) function, is not associated with an instance of the class. A static class is a class which can only contain static members, and therefore cannot be instantiated. For example: class SomeClass { public int InstanceMethod() { return 1; } public static int StaticMethod() { return 42; } } In order to call InstanceMethod, you need an instance of the class: SomeClass instance = new SomeClass(); instance.InstanceMethod(); //Fine instance.StaticMethod(); //Won't compile SomeClass.InstanceMethod(); //Won't compile SomeClass.StaticMethod(); //Fine
  • 13. Loops and Conditional Statements CODING IS DANGEROUS ,SO TAKE THESE WITH YOU.
  • 14. Iterating Codes Writing the same code again and again is bad practice and is looked down on. This is due to the following reasons: 1. Extra Lines of code makes it harder to navigate the code. 2. More Lines, More Errors. 3. Harder to understand . 4. Alternative are better. Functions: 1. For Loop 2. For Each 3. While Loop 4. Do While 5. If Else Statement 6. Switch Statement
  • 15. For this till here, do that. for (int count = 0; count < 100; count++) { <Insert your Code here> } A normal incrementing for loop There are several types of for loop variations. These are some of them: 1. Incrementing 2. Decrement 3. Increment, step 4. Decrement, step 5. Function 6. Char Looping inside a loop inside a loop and on and on. You can have nigh endless amounts of them but what are you going to use them for?? A normal 3 loop example would be going through all the cells of a 3D array. Visualizing a 3D object would be easy but what would happen when you start thinking about a 4D object or more.
  • 16. For Loops for (int count = 0; count < 100; count++) { <Insert your Code here> } There are 3 statements in the for loop function which makes it unique. 1. The first one initializes a variable or uses a variable or your making. Here we initialize a variable called count which is an int type with the value of 0 2. The second statement gives the compiler a condition where the loop would end. Over here, we want it to run till the point where it has reached 100 and it stops at 100. 3. The third statement tells the compiler that the variable count will increase its value by 1 every step. A FOR loop has certain condition where it has its advantages and disadvantages. These are some: 1. All loops work with strings and char type but a FOR loop is preferred for its syntax and index variable. 2. It is often the fastest way to loop over large sets of numbers. It is easy for the compiler to optimize. 3. Nesting loops inside is confusing. 4. Optimization requires quite a lot of brainstorming because faster methods are not as simple as using a for loop.