SlideShare a Scribd company logo
1 of 6
Nayyab Mir
1922110025
Topic: Data Types and Objects
DataTypesin
C#:-
 A data type specifies the size and type of variable
values.
 It means we must declare the type of a variable that
indicates the kind of values it is going to store, such as
integer, float, decimal, text, etc.
DataTypes
inC#:-
Data
Type
Size Description
int 4 bytes Stores whole numbers from -
2,147,483,648 to 2,147,483,647
long 8 bytes Stores whole numbers from -
9,223,372,036,854,775,808.
float 4 bytes Stores fractional numbers.
Sufficient for storing 6 to 7 decimal
digits
double 8 bytes Stores fractional numbers.
Sufficient for storing 15 decimal
digits
bool 1 bit Stores true or false values
char 2 bytes Stores a single character/letter,
surrounded by single quotes
string 2 bytes
per
characte
r
Stores a sequence of characters,
surrounded by double quotes
C#Classesand
Objects:-
 Everything in C# is associated with classes and
objects, along with its attributes and methods. For
example: in real life, a car is an object. The car
has attributes, such as weight and color, and methods,
such as drive and brake.
 A Class is like an object constructor, or a "blueprint"
for creating objects.
 Create a Class:-
 To create a class, use the class keyword:
 Create a class named "Car" with a variable color:
 class Car
 {
 string color = "red";
 }
Code:-
 using System; //System:namespace
 public class Program
 {
 public static void Main()
 {
 string stringVar = "Hello World!!";
 int intVar = 100;
 float floatVar = 10.2f;
 char charVar = 'A';
 bool boolVar = true;
 //Console:class of system namespace
 Console.WriteLine(stringVar);
 Console.WriteLine(intVar);
 Console.WriteLine(floatVar);
 Console.WriteLine(charVar);
 Console.WriteLine(boolVar);
 }
 }
Output:-
Hello World!!
100
10.2
A
True
Objects:-
 An object is created from a class. We have already created the
class named Car, so now we can use this to create objects.
 To create an object of Car, specify the class name, followed by
the object name, and use the keyword new:
 using System;
 namespace MyApplication
 {
 class Car
 {
 string color = "red";
 }
 Car myObj = new Car();
 Console.WriteLine(myObj.color);
 }
Output:-
red

More Related Content

Similar to Data Types & Objects .pptx

2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers2CPP06 - Arrays and Pointers
2CPP06 - Arrays and PointersMichael Heron
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptxarjun431527
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Philip Schwarz
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and VariablesIntro C# Book
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in Carshpreetkaur07
 
(2) collections algorithms
(2) collections algorithms(2) collections algorithms
(2) collections algorithmsNico Ludwig
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Abou Bakr Ashraf
 
Learn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysLearn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysEng Teong Cheah
 
cppt-170218053903 (1).pptx
cppt-170218053903 (1).pptxcppt-170218053903 (1).pptx
cppt-170218053903 (1).pptxWatchDog13
 
Getting started with C# Programming
Getting started with C# ProgrammingGetting started with C# Programming
Getting started with C# ProgrammingBhushan Mulmule
 
Keywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netKeywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netJaya Kumari
 
Unidad o informatica en ingles
Unidad o informatica en inglesUnidad o informatica en ingles
Unidad o informatica en inglesMarisa Torrecillas
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYRajeshkumar Reddy
 

Similar to Data Types & Objects .pptx (20)

2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers2CPP06 - Arrays and Pointers
2CPP06 - Arrays and Pointers
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
classes object  fgfhdfgfdgfgfgfgfdoop.pptxclasses object  fgfhdfgfdgfgfgfgfdoop.pptx
classes object fgfhdfgfdgfgfgfgfdoop.pptx
 
C#
C#C#
C#
 
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 2
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and Variables
 
Javascript analysis
Javascript analysisJavascript analysis
Javascript analysis
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
Introduction to java and oop
 
Functions, Strings ,Storage classes in C
 Functions, Strings ,Storage classes in C Functions, Strings ,Storage classes in C
Functions, Strings ,Storage classes in C
 
C tutorial
C tutorialC tutorial
C tutorial
 
(2) collections algorithms
(2) collections algorithms(2) collections algorithms
(2) collections algorithms
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
 
Visula C# Programming Lecture 2
Visula C# Programming Lecture 2Visula C# Programming Lecture 2
Visula C# Programming Lecture 2
 
Classes1
Classes1Classes1
Classes1
 
Learn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & ArraysLearn C# Programming - Nullables & Arrays
Learn C# Programming - Nullables & Arrays
 
cppt-170218053903 (1).pptx
cppt-170218053903 (1).pptxcppt-170218053903 (1).pptx
cppt-170218053903 (1).pptx
 
Getting started with C# Programming
Getting started with C# ProgrammingGetting started with C# Programming
Getting started with C# Programming
 
Keywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.netKeywords, identifiers and data type of vb.net
Keywords, identifiers and data type of vb.net
 
Unidad o informatica en ingles
Unidad o informatica en inglesUnidad o informatica en ingles
Unidad o informatica en ingles
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
 

More from NayyabMirTahir

HR Strategy and work force diversity.pptx
HR Strategy and work force diversity.pptxHR Strategy and work force diversity.pptx
HR Strategy and work force diversity.pptxNayyabMirTahir
 
Group 5 HRM PRESENTATION.pptx
Group 5 HRM PRESENTATION.pptxGroup 5 HRM PRESENTATION.pptx
Group 5 HRM PRESENTATION.pptxNayyabMirTahir
 
Sources of recruitment.pptx
Sources of recruitment.pptxSources of recruitment.pptx
Sources of recruitment.pptxNayyabMirTahir
 
Past Papers (Compiler Construction).pdf
Past Papers (Compiler Construction).pdfPast Papers (Compiler Construction).pdf
Past Papers (Compiler Construction).pdfNayyabMirTahir
 
Organizational Structure, do's and dont's.ppt
Organizational Structure, do's and dont's.pptOrganizational Structure, do's and dont's.ppt
Organizational Structure, do's and dont's.pptNayyabMirTahir
 
Nayyab Mir 1922110025.pdf
Nayyab Mir 1922110025.pdfNayyab Mir 1922110025.pdf
Nayyab Mir 1922110025.pdfNayyabMirTahir
 
computing standards.pdf
computing standards.pdfcomputing standards.pdf
computing standards.pdfNayyabMirTahir
 
Statement of Cash Flows - CR.pdf
Statement of Cash Flows - CR.pdfStatement of Cash Flows - CR.pdf
Statement of Cash Flows - CR.pdfNayyabMirTahir
 
OOAD t1 short questions.pdf
OOAD t1 short questions.pdfOOAD t1 short questions.pdf
OOAD t1 short questions.pdfNayyabMirTahir
 
past papers solved.pdf
past papers solved.pdfpast papers solved.pdf
past papers solved.pdfNayyabMirTahir
 
income statement and journal .pdf
income statement and journal .pdfincome statement and journal .pdf
income statement and journal .pdfNayyabMirTahir
 

More from NayyabMirTahir (20)

HR Strategy and work force diversity.pptx
HR Strategy and work force diversity.pptxHR Strategy and work force diversity.pptx
HR Strategy and work force diversity.pptx
 
Group 5 HRM PRESENTATION.pptx
Group 5 HRM PRESENTATION.pptxGroup 5 HRM PRESENTATION.pptx
Group 5 HRM PRESENTATION.pptx
 
ch1-1.ppt
ch1-1.pptch1-1.ppt
ch1-1.ppt
 
group 4 week 7.pptx
group 4 week 7.pptxgroup 4 week 7.pptx
group 4 week 7.pptx
 
Sources of recruitment.pptx
Sources of recruitment.pptxSources of recruitment.pptx
Sources of recruitment.pptx
 
Past Papers (Compiler Construction).pdf
Past Papers (Compiler Construction).pdfPast Papers (Compiler Construction).pdf
Past Papers (Compiler Construction).pdf
 
Nayyab Mir 25.docx
Nayyab Mir 25.docxNayyab Mir 25.docx
Nayyab Mir 25.docx
 
Organizational Structure, do's and dont's.ppt
Organizational Structure, do's and dont's.pptOrganizational Structure, do's and dont's.ppt
Organizational Structure, do's and dont's.ppt
 
group..4 (1).pptx
group..4 (1).pptxgroup..4 (1).pptx
group..4 (1).pptx
 
MPI.pptx
MPI.pptxMPI.pptx
MPI.pptx
 
Nayyab Mir 1922110025.pdf
Nayyab Mir 1922110025.pdfNayyab Mir 1922110025.pdf
Nayyab Mir 1922110025.pdf
 
computing standards.pdf
computing standards.pdfcomputing standards.pdf
computing standards.pdf
 
Statement of Cash Flows - CR.pdf
Statement of Cash Flows - CR.pdfStatement of Cash Flows - CR.pdf
Statement of Cash Flows - CR.pdf
 
Spatial filters.pdf
Spatial filters.pdfSpatial filters.pdf
Spatial filters.pdf
 
OOAD t1 short questions.pdf
OOAD t1 short questions.pdfOOAD t1 short questions.pdf
OOAD t1 short questions.pdf
 
AI week 2.pdf
AI week 2.pdfAI week 2.pdf
AI week 2.pdf
 
past papers solved.pdf
past papers solved.pdfpast papers solved.pdf
past papers solved.pdf
 
Lecture 1 FA.docx
Lecture 1 FA.docxLecture 1 FA.docx
Lecture 1 FA.docx
 
income statement and journal .pdf
income statement and journal .pdfincome statement and journal .pdf
income statement and journal .pdf
 
accrual examples .pdf
accrual examples .pdfaccrual examples .pdf
accrual examples .pdf
 

Recently uploaded

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 

Recently uploaded (20)

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 

Data Types & Objects .pptx

  • 2. DataTypesin C#:-  A data type specifies the size and type of variable values.  It means we must declare the type of a variable that indicates the kind of values it is going to store, such as integer, float, decimal, text, etc.
  • 3. DataTypes inC#:- Data Type Size Description int 4 bytes Stores whole numbers from - 2,147,483,648 to 2,147,483,647 long 8 bytes Stores whole numbers from - 9,223,372,036,854,775,808. float 4 bytes Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits double 8 bytes Stores fractional numbers. Sufficient for storing 15 decimal digits bool 1 bit Stores true or false values char 2 bytes Stores a single character/letter, surrounded by single quotes string 2 bytes per characte r Stores a sequence of characters, surrounded by double quotes
  • 4. C#Classesand Objects:-  Everything in C# is associated with classes and objects, along with its attributes and methods. For example: in real life, a car is an object. The car has attributes, such as weight and color, and methods, such as drive and brake.  A Class is like an object constructor, or a "blueprint" for creating objects.  Create a Class:-  To create a class, use the class keyword:  Create a class named "Car" with a variable color:  class Car  {  string color = "red";  }
  • 5. Code:-  using System; //System:namespace  public class Program  {  public static void Main()  {  string stringVar = "Hello World!!";  int intVar = 100;  float floatVar = 10.2f;  char charVar = 'A';  bool boolVar = true;  //Console:class of system namespace  Console.WriteLine(stringVar);  Console.WriteLine(intVar);  Console.WriteLine(floatVar);  Console.WriteLine(charVar);  Console.WriteLine(boolVar);  }  } Output:- Hello World!! 100 10.2 A True
  • 6. Objects:-  An object is created from a class. We have already created the class named Car, so now we can use this to create objects.  To create an object of Car, specify the class name, followed by the object name, and use the keyword new:  using System;  namespace MyApplication  {  class Car  {  string color = "red";  }  Car myObj = new Car();  Console.WriteLine(myObj.color);  } Output:- red