You are on page 1of 8

Class :- s.y.

bvoc (sd)
Roll No. :- 18
Sub :- C#. net
DATA TYPE IN C#
DATA TYPE IN C#

C# Data Types

Value Types Reference Type

Predefined User Defined Predefined User Defined

1)Characters 1)Structures 1)Objects 1)Classes


2)Integers 2)Enumeration 2)Strings 2)Arrays
3)Reals 3)Delegates
4)Interfaces
DATA TYPES IN C#
 Value types
 Pre-defined :
 Int, unit, float, etc.
 User-defined:
Structures and Enumerations
 Reference types
 Pre-defined:
 Objects
 Strings
 User-defined:
 Classes
 Arrays
 Delegates
 Interfaces
DATA TYPES IN C#

C# Value vs. Reference


• Value types “directly contain”
the variable data
- Example: int, float, enum,
Struct….
• Reference Types contain a
reference to the data
Reference Type Value types
Memory Memory
ref0 int x
Ref1 my int y
object
DATA TYPES IN
C#
Value type
 Value-types inherit directly from Value Type
Built in types (bool, int,…etc)
enum types
struct types
 All value-types are sealed
 Value-types cannot be null
 Assignment of a value-type results in a copy of the variable
DATA TYPES IN C#
Reference Types
 Classes
- Object (System object)
- String
- User-defined classes
 Interfaces
 Arrays
 Delegates
- delegate (System Delegate)
THANK YOU

You might also like