Professional Documents
Culture Documents
C#
C#
*********
Implicit conversion
int num1 = 10;
double num2 = num1; // Implicit conversion
Explicit conversion>>>>
double num1 = 10.5;
int num2 = (int)num1; // Explicit conversion
*********
*********
*********
string greeting = "Hello World!";
greeting += " from Tutorials Teacher."; // creates a new string object with new
address
*********
*********
*********
*********
*********
int [] = { 2 , 3 , 5}
int [,]= { {2 , 3 , 5} , {2 , 3 , 5} }
*********
nullable types => ?
*********
s1 ="Mahfouz";=> Value.
*********
*********
*********
*********
*********
*********
*********
*********
Ref and Out in Methods => Ref should assign to value in calling
=> out can assign value in method.
*********
OOP - Properties in C#
set and get accessories
*********
Class VS Struct
*********
*********
Enums => For Readability and ease to use ||| Strongly Typed Named Constants and
support number datatype and can't support string
Flags => Meaning 0 or 1
enum year
{
// items of the enum
January,
February,
March,
April,
May,
June
}
Console.WriteLine(year.January); // January
*********
Inheritance => Readability, reuseability , and avoid DRY .
Polymorphism =>
Abstractions =>
*********
*********
*********
*********
*********
*********
*********
*********
******************
*********
******************
*********
******************
*********
******************
*********
*********