DEV Community

Jamoliddin
Jamoliddin

Posted on

C# da typelar

C# da xotiraga 2 xil usulda saqlanadi Reference type alohida va value typelar alohida saqlanadi
*Reference type *

string
Arrays 
class
interface
delegate
Enter fullscreen mode Exit fullscreen mode

Value type

bool
byte
char
decimal
double
enum
float
int
long
sbyte
short
struct
uint
ulong
ushort
Enter fullscreen mode Exit fullscreen mode

Farqi

Reference type lar heap xotiraga value type lar stack xotiradan joy egallaydi. Reference type lar ishlashi pointerga o'xshaydi. Masalan

 string a , b ; a = hello ;
b = a;
Enter fullscreen mode Exit fullscreen mode

bunda a ga heap xotiradan joy ajratadi b ni a ga o'zlashtirganimizda a ga alohida joy ajratmasdan xuddi pointer kabi murojat qiladi.Value type larda esa aksincha bo'ladi

Top comments (0)