SlideShare a Scribd company logo
1 of 16
Платформата Microsoft .NET и
езикът на програмиране C#
Основи на езика на програмиране C#
Типове данни
 Value types – стойностни типове
 Reference types – референтни типове
 Pointer types – указателни типове
Value types
 Съдържат самата стойност в себе си
 Наследяват System.ValueType
 Цели числа:
 byte/sbyte 1, ushort/short 2, uint/int 4, ulong/long 8
 Реални числа:
 float 4, double 8, decimal 16
 Логически
 bool (true, false)
 Символен
 char 2
Reference types
 Сочат адрес от паметта, където стоят данните
 Промените направени през една референция са видими от другите
референции към същата памет
 object, string
Pointer types
 Unsafe Codes
 Pointer arithmetic
Литерали
 Цели числа:
 int -2147483648, -1, 0, 1, 456789, 2147483647
 long -5L, 0L, 7893456789L, 9223372036854775807L
 Реални числа:
 float 3.14F, double 3.14D, decimal 3.14M
 Логически
 bool true, false
 Символен
 char ‘a’, ‘4’, ‘ ’
 Низове
 string “some text”
Променливи
 int x = 10;
 Правила при именуване
 Обхват
Анонимни типове
 var v = new { Amount = 108, Message = "Hello" };
 Console.WriteLine(v.Amount + v.Message);
Въвеждане, извеждане в конзлоно приложение
 DateTime datе = DateTime.Now;
 Console.WriteLine("Today is {0:d} at {0:T}.", datе);
 string text = Console.ReadLine();
 int number = Int32.Parse(text);
 Console.WriteLine(number*2);
Структурни и референтни типове
 public struct Book
 {
 public decimal price;
 public string title;
 }
 public class Book
 {
 public decimal price;
 public string title;
 }
Преобразуване на типове
 Implicit conversion
 Explicit conversion – type casting
Оператори
 https://msdn.microsoft.com/en-us/library/6a71f45d.aspx
Условни оператори
 if
 if else
 switch
 ?:
Цикли
 while
 for
 do while
 nested loops
Използване на nameof
 int xyz = 10;
 Console.WriteLine(nameof(xyz));

More Related Content

Viewers also liked (11)

.NET/C#_3
.NET/C#_3.NET/C#_3
.NET/C#_3
 
.NET/C#_16
.NET/C#_16.NET/C#_16
.NET/C#_16
 
.NET/C#_17
.NET/C#_17.NET/C#_17
.NET/C#_17
 
.NET/C#_10
.NET/C#_10.NET/C#_10
.NET/C#_10
 
.NET/C#_7
.NET/C#_7.NET/C#_7
.NET/C#_7
 
.NET/C#_15
.NET/C#_15.NET/C#_15
.NET/C#_15
 
.NET/C#_1
.NET/C#_1.NET/C#_1
.NET/C#_1
 
.NET/C#_19
.NET/C#_19.NET/C#_19
.NET/C#_19
 
.NET/C#_4
.NET/C#_4.NET/C#_4
.NET/C#_4
 
.NET/C#_5
.NET/C#_5.NET/C#_5
.NET/C#_5
 
.NET/C#_14
.NET/C#_14.NET/C#_14
.NET/C#_14
 

More from RaynaITSTEP

Project management professional
Project management professionalProject management professional
Project management professionalRaynaITSTEP
 
Project management it step
Project management it stepProject management it step
Project management it stepRaynaITSTEP
 
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)RaynaITSTEP
 
monitoring and diagnostics
monitoring and diagnosticsmonitoring and diagnostics
monitoring and diagnosticsRaynaITSTEP
 
network security
network securitynetwork security
network securityRaynaITSTEP
 
configuring disk sand drivers
configuring disk sand driversconfiguring disk sand drivers
configuring disk sand driversRaynaITSTEP
 
install update and migration to windows 10
install update and migration to windows 10install update and migration to windows 10
install update and migration to windows 10RaynaITSTEP
 
Фотошоп за деца_4
Фотошоп за деца_4Фотошоп за деца_4
Фотошоп за деца_4RaynaITSTEP
 
Структурни кабелни системи
Структурни кабелни системиСтруктурни кабелни системи
Структурни кабелни системиRaynaITSTEP
 
Android introduction
Android introductionAndroid introduction
Android introductionRaynaITSTEP
 
Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2RaynaITSTEP
 
Adobe Illustrator - Обобщение
Adobe Illustrator - ОбобщениеAdobe Illustrator - Обобщение
Adobe Illustrator - ОбобщениеRaynaITSTEP
 

More from RaynaITSTEP (20)

Project management professional
Project management professionalProject management professional
Project management professional
 
Project management it step
Project management it stepProject management it step
Project management it step
 
Lean startup
Lean startupLean startup
Lean startup
 
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)
РАБОТА С ОБЕКТА „ЗАЯВКА“ (2)
 
DBT_3
DBT_3DBT_3
DBT_3
 
DBT_2
DBT_2DBT_2
DBT_2
 
DBT_1
DBT_1DBT_1
DBT_1
 
monitoring and diagnostics
monitoring and diagnosticsmonitoring and diagnostics
monitoring and diagnostics
 
network security
network securitynetwork security
network security
 
networking
networkingnetworking
networking
 
data security
data securitydata security
data security
 
configuring disk sand drivers
configuring disk sand driversconfiguring disk sand drivers
configuring disk sand drivers
 
boot process
boot process  boot process
boot process
 
install update and migration to windows 10
install update and migration to windows 10install update and migration to windows 10
install update and migration to windows 10
 
virtualization
virtualizationvirtualization
virtualization
 
Фотошоп за деца_4
Фотошоп за деца_4Фотошоп за деца_4
Фотошоп за деца_4
 
Структурни кабелни системи
Структурни кабелни системиСтруктурни кабелни системи
Структурни кабелни системи
 
Android introduction
Android introductionAndroid introduction
Android introduction
 
Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2Adobe Illustrator - Урок 2
Adobe Illustrator - Урок 2
 
Adobe Illustrator - Обобщение
Adobe Illustrator - ОбобщениеAdobe Illustrator - Обобщение
Adobe Illustrator - Обобщение
 

.NET/C#_2