Hi, Well come to Fahad Hussain Free Computer Education Here you can learn Complete computer Science, IT related course absolutely Free! As we know C# (C sharp) is one of the powerful Dot Net Language. In the series of Video you will learn C# (C sharp) from Scratch using Visual Studio 2015... The whole course base on the concept of theory and Practical! for Further Assistance and code visit: https://fahadhussaincs.blogspot.com/ For Complete course YouTube Channel: https://www.youtube.com/channel/UCapJ...
Tutorial No. 01:
Click to WATCH the Series of Videos
Introduction to, what Is Dot Net Framework | What is C# | Architecture of .NET (Urdu/Hindi) (Theory)
Tutorial No. 02:
Click to WATCH the Series of Videos
using System;
class Program
{
static void Main(string[] args)
{
Console.Write("Hi");
Console.WriteLine("Fahad Hussain");
Console.Write("Hi");
}
}
Tutorial No. 03:
Click to WATCH the Series of Videos
//Built -in types in C#
//1.Boolean type – Only true or false(bool vs Boolean)
//2.Integral Types - sbyte, byte, short, ushort, int, uint, long, ulong, char
//3.Floating Types – float and double
//4.Decimal Types
//5.String Type
//6: Null Able ?
bool aa = true;
Console.WriteLine(aa);
Console.WriteLine("VALUE TYPE:");
Console.WriteLine("---------------------------------------------");
Console.WriteLine("Integers:");
byte a = 12;
Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}", a, typeof(byte), byte.MaxValue, byte.MinValue);
sbyte b = 12;
Console.WriteLine("sbyte\tB = {0}\t{1}\t{2}\t{3}", b, typeof(sbyte), sbyte.MaxValue, sbyte.MinValue);
short c = 12;
Console.WriteLine("short\tC = {0}\t{1}\t{2}\t{3}", c, typeof(short), short.MaxValue, short.MinValue);
ushort d = 12;
Console.WriteLine("ushort\tD = {0}\t{1}\t{2}\t{3}", d, typeof(ushort), ushort.MaxValue, ushort.MinValue);
int e = 12;
Console.WriteLine("int\tE = {0}\t{1}\t{2}\t{3}", e, typeof(int), int.MaxValue, int.MinValue);
uint f = 12;
Console.WriteLine("unit\tF = {0}\t{1}\t{2}\t{3}", f, typeof(uint), uint.MaxValue, uint.MinValue);
long g = 12;
Console.WriteLine("long\tG = {0}\t{1}\t{2}\t{3}", g, typeof(long), long.MaxValue, long.MinValue);
ulong h = 12;
Console.WriteLine("ulong\tH = {0}\t{1}\t{2}\t{3}", h, typeof(ulong), ulong.MaxValue, ulong.MinValue);
Console.WriteLine("\nFloating Point:");
float i = 123.34f;
Console.WriteLine("float\tI = {0}\t{1}\t{2}\t{3}", i, typeof(float), float.MaxValue, float.MinValue);
double j = 123.34;
Console.WriteLine("double\tJ = {0}\t{1}\t{2}\t{3}", j, typeof(double), double.MaxValue, double.MinValue);
decimal k = 123.34m;
Console.WriteLine("decimal\tK = {0}\t{1}\t{2}\t{3}", k, typeof(decimal), decimal.MaxValue, decimal.MinValue);
Console.WriteLine("\nText:");
char l = 'f';
Console.WriteLine("char\tL = {0}\t{1}", l, typeof(char));
Console.WriteLine("\nBoolean:");
bool m = true;
Console.WriteLine("bool\tM = {0}\t{1}", m, typeof(bool));
Tutorial No. 04:
Click to WATCH the Series of Videos
// concatenation and place holder in C#
int a = 12;
short b = 45;
string c = "Fahad";
Console.WriteLine("The value of a is: " + a + ", the value of b is: " + b + ", c is: " + c);
Console.WriteLine("The value of a is: {2}, the value of b is: {1}, c is: {0}", a, b, c);
Tutorial No. 05:
Click to WATCH the Series of Videos
// typeof(byte),
//byte.MaxValue,
// byte.MinValue,
// sizeof(byte)
byte a = 12;
Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}\t{4}", a, typeof(byte), byte.MaxValue, byte.MinValue, sizeof(byte));
Tutorial No. 06:
Click to WATCH the Series of Videos
//Assignment Operator =
//int a;
// a = 12;
//int a = 12;
//Arithmetic Operators like +,-,*,/,%
int a=11, b=2;
int w, x, y, z,mod;
w = a + b;
Console.WriteLine(w);
x = a - b;
Console.WriteLine(x);
y = a * b;
Console.WriteLine(y);
z = a / b;
Console.WriteLine(z);
mod = a % b;
Console.WriteLine(mod);
//Comparison Operators like ==, !=,>, >=, <, <=
int a = 11, b = 2;
bool c, d, e;
c = a < b;
Console.WriteLine(c);
//Conditional Operators like &&, ||, !
int a = 2, b = 5;
bool c;
c = !(a >= 2);
Console.WriteLine(c);
//Ternary Operator ?:
int number = 10;
// Ternary operator example
string isNumber10 = number == 10 ? "True is 10" : "False is not 10";
Console.WriteLine("Number == 10 is {0}", isNumber10);
Tutorial No. 07:
Click to WATCH the Series of Videos
int? z = null;
Console.WriteLine(z);
string b = null;
string c = null;
string d = null;
string e = "Fahad";
string result = b ?? e ?? d ?? c;
Console.WriteLine(result);
Tutorial No. 08:
Click to WATCH the Series of Videos
// if-statement()
//ONLY IF
int a = 12;
if(a==13)
{
Console.WriteLine("The value of a is 12, TRUE");
}
//IF WITH ELSE
int a = 12;
if (a == 13)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else
{
Console.WriteLine("The value of a is not 12, FALSE");
}
//IF WITH ELSE-IF
int a = 130;
if (a == 12)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else if( a==13)
{
Console.WriteLine("The value of a is not 12, FALSE");
}
//IF WITH ELSE-IF + ELSE
int a = 130;
if (a == 12)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else if (a == 13)
{
Console.WriteLine("The value of a is not 12, FALSE");
}
else
{
Console.WriteLine("Default Else!");
}
Tutorial No. 09:
Click to WATCH the Series of Videos
//BitWise Operator in C#
int a = 1; // 0 0 0 1
int b = 2; // 0 0 1 0
int bitAnd = a & b;
Console.WriteLine(bitAnd);
int bitOr = a | b;
Console.WriteLine(bitOr);
int bitNot = ~b;
Console.WriteLine(bitNot);
int bitrightShift = a >> b;
Console.WriteLine(bitrightShift);
int bitleftShift = a << b;
Console.WriteLine(bitleftShift);
Tutorial No. 10:
Click to WATCH the Series of Videos
//switch Case in C#
int a = 1;
char b = 'b';
switch(a)
{
case 1:
Console.WriteLine("The value of a is, acc to case 1 is: "+a);
switch(b)
{
case 'a':
Console.WriteLine("Character a");
break;
case 'b':
Console.WriteLine("Character b");
break;
}
break;
case 2:
Console.WriteLine("The value of a is, acc to case 2 is: " + a);
break;
case 3:
Console.WriteLine("The value of a is, acc to case 3 is: " + a);
break;
default:
Console.WriteLine("Default value");
break;
}
Tutorial No. 11:
Click to WATCH the Series of Videos
// Loops in C#
for (int i = 0; i <= 5; i++) // i =i+1
{
// Console.WriteLine("Fahad Hussain");
Console.WriteLine(i);
for (int j = 0; j <= 5; j++)
{
Console.WriteLine(j);
}
}
//while
int b = 1;
while (b<=10)
{
Console.WriteLine("Fahad Hussain");
b++;
}
// do-while
int c = 12;
do
{
Console.WriteLine("Fahad Hussain");
c++;
} while (c<=10);
foreach (var item in collection)
{
}
Tutorial No. 12:
Click to WATCH the Series of Videos
//User Input in C#, (how to get user input in Console )
byte a;
short b;
int c;
long d;
float e;
double f;
a = Convert.ToByte(Console.ReadLine());
Console.WriteLine("The input value of a is: "+a);
b = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("The input value of a is: " + b);
Tutorial No. 13:
Click to WATCH the Series of Videos
//Array in C# (1d Array, 2d Array, Jagged Array)
int[] arr;
int[] arr1 = new int[5] {1,2,3,47,8 };
int[] arr2 = new int[] { 1, 2, 3, 47, 8,234,5,7,89};
int[] arr3 = new int[10];
int[] arr4 = new int[4];
//arr3[0] = 12;
//arr3[1] = 123;
//arr3[2] = 13;
//Console.WriteLine(arr3[0]);
//Console.WriteLine(arr2[0]);
for (int i = 0; i < arr3.Length; i++)
{
arr3[i] = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine(arr3[i]);
}
foreach (var item in arr3)
{
Console.WriteLine(item);
}
Tutorial No. 14:
Click to WATCH the Series of Videos
// 2D Array
// 0 1 2
// 0 1 2 3
// 1 4 5 6
// 2 7 8 9
int[,] arr;
int[,] arr1 = new int[2,3] {
{1,2,3 },
{7,5,3 }
};
int[,] arr2 = new int[3,3] {
{1,2,3 },
{7,5,3 },
{7,5,7 }
};
int[,] arr3 = new int[2, 3];
foreach (var item in arr2)
{
Console.WriteLine(item);
}
Console.WriteLine("Data through For loop!");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
Console.WriteLine(arr2[i,j]);
}
}
int[,] arr3 = new int[2, 3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
arr3[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
Console.Write(arr3[i, j] + " ");
}
if (i == 0)
{
Console.WriteLine();
}
}
Tutorial No. 15:
Click to WATCH the Series of Videos
// In c#, Jagged Array is an array whose elements are arrays with different dimensions and sizes.
// Sometimes jagged array called as “array of arrays” and it can store arrays instead of
// particular data type value.
// Jagged Array with Single Dimensional Array
int[][] jarray = new int[3][];
jarray[0] = new int[5] { 1, 2, 3, 4, 5 };
jarray[1] = new int[3] { 10, 20, 30 };
jarray[2] = new int[] { 12, 50, 60, 70, 32 };
// Jagged Array with Two Dimensional Array
int[][,] jarray1 = new int[3][,];
jarray1[0] = new int[2, 2] { { 15, 24 }, { 43, 54 } };
jarray1[1] = new int[,] { { 11, 12 }, { 13, 14 }, { 25, 26 } };
jarray1[2] = new int[4, 3];
int[][] arr = new int[2][];// Declare the array
arr[0] = new int[] { 11, 21, 56, 78 };// Initialize the array
arr[1] = new int[] { 42, 61, 37, 41, 59, 63 };
// Traverse array elements
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr[i].Length; j++)
{
System.Console.Write(arr[i][j] + " ");
}
System.Console.WriteLine();
}
Tutorial No. 16:
Click to WATCH the Series of Videos
//Type safe, convert(Class), casting (implict, explict), string(parse,tryparse)
int a = 12;
string b = "12";
int sum = a + Convert.ToInt32(b); //1212
Console.WriteLine(sum);
//Implict casting (low to high data types)
byte c = 13;
int d = c;
Console.WriteLine(d);
////Explict casting (high to low data types)
double cc = 134.123;
int dd = (int)cc;
Console.WriteLine(dd);
//int.parse
string a = "12345";
// int result = int.Parse(a);
//Console.WriteLine(result);
//int.tryparse
int r = 0;
bool res=int.TryParse(a, out r);
Console.WriteLine(res);
if (res)
{
Console.WriteLine("Right");
}
else
{
Console.WriteLine("Wrong");
}
Tutorial No. 17:
Click to WATCH the Series of Videos
//jump statement in C#
// break
// continue
// goto
// return
// throw
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
if(i==5)
{
break;
}
}
for (int i = 0; i < 10; i++)
{
if (i == 5)
{
continue;
}
Console.WriteLine(i);
}
Console.WriteLine("Goto Statement");
Console.WriteLine("Before Goto");
Console.WriteLine("After Goto");
goto statement;
statement:
{
Console.WriteLine("I am goto statement");
}
Tutorial No. 18:
Click to WATCH the Series of Videos
//Syntax Error
//console.WriteLine()
//Logical Error
for (int i = 0; i > 10; i++)
{
Console.WriteLine(i);
}
int a = 12;
int b = 0;
int result = a / b;
//Compile Time Error
Console.writeLine()
// Run Time Error
string r = Console.ReadLine();
int result = int.Parse(r);
Console.WriteLine("The Result is: "+result);
Try-catch Exception(Throw)
int aa = 12 / 0;
Tutorial No. 19:
Click to WATCH the Series of Videos
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
Console.WriteLine("End of Loop");
Tutorial No. 20:
Click to WATCH the Series of Videos
No Required of Code, Watch Video for better understanding...
Tutorial No. 21:
Click to WATCH the Series of Videos
Console.WriteLine("Process {0}",Debugger.IsAttached);
Tutorial No. 22:
Click to WATCH the Series of Videos
No Required of Code, Watch Video for better understanding...
Tutorial No. 23:
Click to WATCH the Series of Videos
class Program
{
static void Main(string[] args)
{
IT_Dept obj = new IT_Dept();
obj.EmpID = 12;
Console.WriteLine(obj.EmpID);
obj.Name = Console.ReadLine();
obj.Dept = Console.ReadLine();
obj.Salary = int.Parse(Console.ReadLine());
//Console.WriteLine(obj.Name);
//Console.WriteLine(obj.Dept);
//Console.WriteLine(obj.Salary);
obj.Info();
}
}
class IT_Dept
{
private int ID;
public int EmpID
{
get
{
return ID;
}
set
{
ID = value;
}
}
public string Name { get; set; }
public string Dept { get; set; }
public int Salary { get; set; }
public void Info()
{
Console.WriteLine("Name of Employee: "+Name);
Console.WriteLine("Dept of Employee: " + Dept);
Console.WriteLine("Salary of Employee: " + Salary);
}
}
Tutorial No. 24:
Click to WATCH the Series of Videos
Tutorial No. 25:
Click to WATCH the Series of Videos
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
IT_Dept obj = new IT_Dept();
obj.EmpID = 12;
Console.WriteLine(obj.EmpID);
obj.Name = Console.ReadLine();
obj.Dept = Console.ReadLine();
obj.Salary = int.Parse(Console.ReadLine());
//Console.WriteLine(obj.Name);
//Console.WriteLine(obj.Dept);
//Console.WriteLine(obj.Salary);
obj.Info();
}
}
class IT_Dept
{
private int ID;
public int EmpID
{
get
{
return ID;
}
set
{
ID = value;
}
}
public string Name { get; set; }
public string Dept { get; set; }
public int Salary { get; set; }
public void Info()
{
Console.WriteLine("Name of Employee: "+Name);
Console.WriteLine("Dept of Employee: " + Dept);
Console.WriteLine("Salary of Employee: " + Salary);
}
}
Tutorial No. 26:
Click to WATCH the Series of Videos
namespace Inheritance
{
class Program
{
static void Main(string[] args)
{
//B obj = new B();
//obj.AClasMethod();
C obj = new C();
obj.AClasMethod();
}
}
class A
{
public void AClasMethod()
{
Console.WriteLine("Method of class A");
}
}
class B : A
{
public void BClasMethod()
{
Console.WriteLine("Method of class B");
}
}
class C :A
{
}
// class D : A,B,C
// {
// }
}
Tutorial No. 27:
Click to WATCH the Series of Videos
its all about the Concept of Theory , watch till the end for better understanding...
Tutorial No. 28:
Click to WATCH the Series of Videos
namespace Constructor
{
class Program
{
static void Main(string[] args)
{
Employee obj = new Employee();
obj.EmpDetail();
Employee obj1 = new Employee(12, "FahadHussain");
obj1.EmpDetail();
Employee obj2 = new Employee(123, "Ali", 45.45);
obj2.EmpDetail();
}
}
class Employee
{
int Id;
string name;
double IDDept;
public Employee()
{
}
public Employee(int Id, string name)
{
this.Id = Id;
this.name = name;
}
public Employee(int Id, string name, double IDDept)
{
this.Id = Id;
this.name = name;
this.IDDept = IDDept;
}
public void EmpDetail()
{
Console.WriteLine("The Id of Employee: {0}",Id);
Console.WriteLine("The Name of Employee: {0}", name);
Console.WriteLine("The IDDept of Employee: {0}", IDDept);
}
}
Tutorial No. 29:
Click to WATCH the Series of Videos
namespace Destructure
{
class Program
{
static void Main(string[] args)
{
A obj = new A(1,"Fahad");
obj.BioData();
A obj1 = new A(11, "Ali");
obj1.BioData();
}
}
class A
{
public int Id;
public string name;
public A(int Id, string name)
{
this.Id = Id;
this.name = name;
}
public void BioData()
{
Console.WriteLine("{0}",Id);
Console.WriteLine("{0}", name);
}
~A()
{
Console.WriteLine("Destrcutor Called!");
}
}
Tutorial No. 30:
Click to WATCH the Series of Videos
namespace Polymorphism_FunctionOverload
{
class Program
{
static void Main(string[] args)
{
Employee obj = new Employee();
obj.abc(12);
obj.abc(45.48);
obj.abc(45.23, 789);
}
}
class Employee
{
public void abc(int a)
{
Console.WriteLine(" int value {0}", a);
}
public void abc(double b)
{
Console.WriteLine(" Double value {0}",b);
}
public void abc(double b, int c)
{
Console.WriteLine(" Double value {0} and c is {1}", b,c);
}
}
Tutorial No. 31:
Click to WATCH the Series of Videos
namespace Operator_overload
{
class Program
{
static void Main(string[] args)
{
//Console.WriteLine(2 + 2);
//Console.WriteLine("Fahad" + "Hussain");
//Console.WriteLine(obj1 + obj2 =objj);
Emp obj1 = new Emp();
obj1.Id = 2;
obj1.name = "Fahad";
Emp obj2 = new Emp();
obj2.Id = 2;
obj2.name = "Hussain";
Emp obj3 = new Emp();
obj3 = obj1 + obj2;
Console.WriteLine(obj3.Id);
Console.WriteLine(obj3.name);
}
}
class Emp
{
public int Id = 0;
public string name = "";
public static Emp operator +(Emp obj1, Emp obj2)
{
Emp obj3 = new Emp();
obj3.Id = obj1.Id + obj2.Id;
obj3.name = obj1.name + obj2.name;
return obj3;
}
}
namespace Dynamic_polymorphism
{
class Program
{
static void Main(string[] args)
{
// ChildClass obj = new ChildClass();
// obj.method();
// BaseClass obj1 = new ChildClass();
// obj1.method();
//ChildClass obj = new ChildClass();
//obj.method();
BaseClass obj1 = new ChildClass();
obj1.method();
}
}
//class BaseClass
//{
// public void method()
// {
// Console.WriteLine("This is Base Class method");
// }
//}
//class ChildClass: BaseClass
//{
// public void method()
// {
// base.method();
// Console.WriteLine("This is Child Class method");
// }
//}
Tutorial No. 33:
Click to WATCH the Series of Videos
namespace Abstraction
{
class Program
{
static void Main(string[] args)
{
Bus obj = new Bus();
obj.Speed();
obj.HighWay();
Car obj1 = new Car();
obj1.Speed();
obj1.HighWay();
// Vehicle oo = new Vehicle();
}
}
abstract class Vehicle
{
public void HighWay()
{
Console.WriteLine("This is SimpleMethod in Abstact Class!");
}
public abstract void Speed();
}
class Car: Vehicle
{
public override void Speed()
{
Console.WriteLine("Car speed is over 80km/h!");
}
}
class Bus : Vehicle
{
public override void Speed()
{
Console.WriteLine("Bus speed is over 65km/h!");
}
}
}
Tutorial No. 34:
Click to WATCH the Series of Videos
namespace Interface
{
class Program
{
static void Main(string[] args)
{
D obj = new D();
obj.interfaceMethod1();
obj.interfaceMethod2();
obj.interfaceMethod3();
}
}
interface A
{
void interfaceMethod1();
}
interface B
{
void interfaceMethod2();
}
interface C:A,B
{
void interfaceMethod3();
}
class D:C
{
public void interfaceMethod1()
{
Console.WriteLine("Body of interfaceMethod1");
}
public void interfaceMethod2()
{
Console.WriteLine("Body of interfaceMethod2");
}
public void interfaceMethod3()
{
Console.WriteLine("Body of interfaceMethod3");
}
}
}
Tutorial No. 35:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Tutorial No. 36:
Click to WATCH the Series of Videos
namespace Exceptional_Handling
{
class Program
{
static void Main(string[] args)
{
//Try
//Catch
//finally
//throw
//Console.WriteLine("Hello!");
//int a = 12;
//int b = 0;
//Console.WriteLine(c);
//Console.WriteLine("World!");
int a = 12;
int b = 0;
try
{
int c = a / b;
Console.WriteLine(c);
}
catch(DivideByZeroException ex)
{
Console.WriteLine("Zero in Not allowed!");
throw ex;
}
finally
{
Console.WriteLine("Finally keyword, Default!");
}
}
}
}
Tutorial No. 37:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Tutorial No. 38:
Click to WATCH the Series of Videos
int a=1;
Console.WriteLine(a);
object aa=12;
object bb=12;
object cc=(int)aa + 12;
Console.WriteLine(cc);
object dd =cc;
Console.WriteLine(dd);
var ab= 12;
var ac= ab +12;
dynamic ad = 12;
dynamic ae = ad + 12;
dynamic az = ae;
object aa=12;
Tutorial No. 39:
Click to WATCH the Series of Videos
namespace Structure
{
class Program
{
static void Main(string[] args)
{
A obj = new A();
//Console.WriteLine( obj.id = 12);
//Console.WriteLine(obj.name = "Fahad");
//obj.functionA();
obj.call(12, "Fahad");
obj.functionA();
float a = 12;
int* ptr = & a;
}
}
struct A
{
public int id;
public string name;
public void call(int id, string name)
{
this.id = id;
this.name = name;
}
public void functionA()
{
Console.WriteLine(id);
Console.WriteLine(name);
}
}
}
Tutorial No. 40:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Tutorial No. 41:
Click to WATCH the Series of Videos
namespace Enum
{
class Program
{
enum months
{
jan,
feb,
march,
april,
may,
june,
july,
august,
sep,
oct,
nov,
dec
}
static void Main(string[] args)
{
// Console.WriteLine( months.august);
// Console.WriteLine( (double)months.august);
// Console.WriteLine(months.GetName(typeof(months),8));
//// Console.WriteLine("months constant names:");
// foreach (string str in months.GetNames(typeof(months)))
// Console.WriteLine(str);
Console.WriteLine(3+3);
Console.WriteLine("Fahad"+"Hussain");
}
}
}
Tutorial No. 42:
Click to WATCH the Series of Videos
//int num = 23; // value type is int and assigned value 23
//object Obj = num; // Boxing
//int i = (int)Obj; // Unboxing
Tutorial No. 43:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
A obj = new A();
Console.WriteLine(obj.a);
Console.WriteLine(obj.name);
obj.Login();
}
}
public partial class A
{
public int a =12;
public string name="Ali"
}
public partial class A
{
public void Login()
{
Console.WriteLine("login method in Class A");
}
}
}
Tutorial No. 44:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
ClassA obj = new ClassA();
obj.SetSalary();
}
}
//public partial class ClassA
//{
// partial void SetData();
//}
//public partial class ClassA
//{
// public void SetSalary()
// {
// SetData();
// // Perform other functionality here
// }
// partial void SetData()
// {
// Console.Write("This is partial method.");
// Console.ReadKey();
}
}
}
Tutorial No. 45:
Click to WATCH the Series of Videos
First Concept of Sealed Class,
//class A
//{
//}
//sealed class B :A
//{
//}
//sealed class C :B
//{
//}
//class D : B
//{
//}
Second Concept of Sealed Class,
namespace Advance_C_Sharp
{
class Program
{
static void Main(string[] args)
{
//A obj = new A();
//Console.WriteLine(obj.a);
//Console.WriteLine(obj.name);
//obj.Login();
//Employee obj = new Employee();
//obj.Show();
//obj.login();
//Employee obj1 = new Dept();
//obj1.Show();
//obj1.login();
//Employee obj2 = new Salary();
//obj2.Show();
// obj2.login();
}
}
//class Employee
//{
// public virtual void Show()
// {
// Console.WriteLine("Show method in Employee Class");
// }
// public virtual void login()
// {
// Console.WriteLine("login method in Employee Class");
// }
//}
//class Dept: Employee
//{
// sealed public override void Show()
// {
// Console.WriteLine("Show method in Dept Class");
// }
// public override void login()
// {
// Console.WriteLine("login method in Dept Class");
// }
//}
//class Salary: Dept
//{
// public override void login()
// {
// Console.WriteLine("login method in Salary Class");
// }
//}
}
Tutorial No. 46:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
//int i = 10;
//bool result = i.IsGreaterThan(100);
//Console.WriteLine(result);
}
}
//public static class IntExtensions
//{
// public static bool IsGreaterThan(this int i, int value)
// {
// return i > value;
// }
//}
}
Tutorial No. 47:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
public int Add(int a, int b)
{
return a + b;
}
Console.WriteLine(sum(2,3));
}
}
}
Tutorial No. 48:
Click to WATCH the Series of Videos
namespace Advance_C_Sharp
{
class Program
{
static void Main(string[] args)
{
//is =is it you?
//int a = 12;
//if(a is string)
//{
// Console.WriteLine("False");
//}
//as = Asim, do work as like Ali
//object z = 159;
//string aa = z as string;
}
}
}
Tutorial No. 49:
Click to WATCH the Series of Videos
namespace ConsoleApplication6
{
class Program
{
//const compile time
//readonly runtime
// const int a = 12;
static void Main(string[] args)
{
//a = 123;
//Console.WriteLine(a);
A obj = new A(45);
}
}
class A
{
readonly int b;
public A(int bb)
{
this.b = bb;
Console.WriteLine(b);
}
}
}
Tutorial No. 01:
Click to WATCH the Series of Videos
Introduction to, what Is Dot Net Framework | What is C# | Architecture of .NET (Urdu/Hindi) (Theory)
Tutorial No. 02:
Click to WATCH the Series of Videos
using System;
class Program
{
static void Main(string[] args)
{
Console.Write("Hi");
Console.WriteLine("Fahad Hussain");
Console.Write("Hi");
}
}
Tutorial No. 03:
Click to WATCH the Series of Videos
//Built -in types in C#
//1.Boolean type – Only true or false(bool vs Boolean)
//2.Integral Types - sbyte, byte, short, ushort, int, uint, long, ulong, char
//3.Floating Types – float and double
//4.Decimal Types
//5.String Type
//6: Null Able ?
bool aa = true;
Console.WriteLine(aa);
Console.WriteLine("VALUE TYPE:");
Console.WriteLine("---------------------------------------------");
Console.WriteLine("Integers:");
byte a = 12;
Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}", a, typeof(byte), byte.MaxValue, byte.MinValue);
sbyte b = 12;
Console.WriteLine("sbyte\tB = {0}\t{1}\t{2}\t{3}", b, typeof(sbyte), sbyte.MaxValue, sbyte.MinValue);
short c = 12;
Console.WriteLine("short\tC = {0}\t{1}\t{2}\t{3}", c, typeof(short), short.MaxValue, short.MinValue);
ushort d = 12;
Console.WriteLine("ushort\tD = {0}\t{1}\t{2}\t{3}", d, typeof(ushort), ushort.MaxValue, ushort.MinValue);
int e = 12;
Console.WriteLine("int\tE = {0}\t{1}\t{2}\t{3}", e, typeof(int), int.MaxValue, int.MinValue);
uint f = 12;
Console.WriteLine("unit\tF = {0}\t{1}\t{2}\t{3}", f, typeof(uint), uint.MaxValue, uint.MinValue);
long g = 12;
Console.WriteLine("long\tG = {0}\t{1}\t{2}\t{3}", g, typeof(long), long.MaxValue, long.MinValue);
ulong h = 12;
Console.WriteLine("ulong\tH = {0}\t{1}\t{2}\t{3}", h, typeof(ulong), ulong.MaxValue, ulong.MinValue);
Console.WriteLine("\nFloating Point:");
float i = 123.34f;
Console.WriteLine("float\tI = {0}\t{1}\t{2}\t{3}", i, typeof(float), float.MaxValue, float.MinValue);
double j = 123.34;
Console.WriteLine("double\tJ = {0}\t{1}\t{2}\t{3}", j, typeof(double), double.MaxValue, double.MinValue);
decimal k = 123.34m;
Console.WriteLine("decimal\tK = {0}\t{1}\t{2}\t{3}", k, typeof(decimal), decimal.MaxValue, decimal.MinValue);
Console.WriteLine("\nText:");
char l = 'f';
Console.WriteLine("char\tL = {0}\t{1}", l, typeof(char));
Console.WriteLine("\nBoolean:");
bool m = true;
Console.WriteLine("bool\tM = {0}\t{1}", m, typeof(bool));
Tutorial No. 04:
Click to WATCH the Series of Videos
// concatenation and place holder in C#
int a = 12;
short b = 45;
string c = "Fahad";
Console.WriteLine("The value of a is: " + a + ", the value of b is: " + b + ", c is: " + c);
Console.WriteLine("The value of a is: {2}, the value of b is: {1}, c is: {0}", a, b, c);
Click to WATCH the Series of Videos
// typeof(byte),
//byte.MaxValue,
// byte.MinValue,
// sizeof(byte)
byte a = 12;
Console.WriteLine("byte\tA = {0}\t{1}\t{2}\t{3}\t{4}", a, typeof(byte), byte.MaxValue, byte.MinValue, sizeof(byte));
Tutorial No. 06:
Click to WATCH the Series of Videos
//Assignment Operator =
//int a;
// a = 12;
//int a = 12;
//Arithmetic Operators like +,-,*,/,%
int a=11, b=2;
int w, x, y, z,mod;
w = a + b;
Console.WriteLine(w);
x = a - b;
Console.WriteLine(x);
y = a * b;
Console.WriteLine(y);
z = a / b;
Console.WriteLine(z);
mod = a % b;
Console.WriteLine(mod);
//Comparison Operators like ==, !=,>, >=, <, <=
int a = 11, b = 2;
bool c, d, e;
c = a < b;
Console.WriteLine(c);
//Conditional Operators like &&, ||, !
int a = 2, b = 5;
bool c;
c = !(a >= 2);
Console.WriteLine(c);
//Ternary Operator ?:
int number = 10;
// Ternary operator example
string isNumber10 = number == 10 ? "True is 10" : "False is not 10";
Console.WriteLine("Number == 10 is {0}", isNumber10);
Tutorial No. 07:
Click to WATCH the Series of Videos
int? z = null;
Console.WriteLine(z);
string b = null;
string c = null;
string d = null;
string e = "Fahad";
string result = b ?? e ?? d ?? c;
Console.WriteLine(result);
Tutorial No. 08:
Click to WATCH the Series of Videos
// if-statement()
//ONLY IF
int a = 12;
if(a==13)
{
Console.WriteLine("The value of a is 12, TRUE");
}
//IF WITH ELSE
int a = 12;
if (a == 13)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else
{
Console.WriteLine("The value of a is not 12, FALSE");
}
//IF WITH ELSE-IF
int a = 130;
if (a == 12)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else if( a==13)
{
Console.WriteLine("The value of a is not 12, FALSE");
}
//IF WITH ELSE-IF + ELSE
int a = 130;
if (a == 12)
{
Console.WriteLine("The value of a is 12, TRUE");
}
else if (a == 13)
{
Console.WriteLine("The value of a is not 12, FALSE");
}
else
{
Console.WriteLine("Default Else!");
}
Tutorial No. 09:
Click to WATCH the Series of Videos
//BitWise Operator in C#
int a = 1; // 0 0 0 1
int b = 2; // 0 0 1 0
int bitAnd = a & b;
Console.WriteLine(bitAnd);
int bitOr = a | b;
Console.WriteLine(bitOr);
int bitNot = ~b;
Console.WriteLine(bitNot);
int bitrightShift = a >> b;
Console.WriteLine(bitrightShift);
int bitleftShift = a << b;
Console.WriteLine(bitleftShift);
Tutorial No. 10:
Click to WATCH the Series of Videos
//switch Case in C#
int a = 1;
char b = 'b';
switch(a)
{
case 1:
Console.WriteLine("The value of a is, acc to case 1 is: "+a);
switch(b)
{
case 'a':
Console.WriteLine("Character a");
break;
case 'b':
Console.WriteLine("Character b");
break;
}
break;
case 2:
Console.WriteLine("The value of a is, acc to case 2 is: " + a);
break;
case 3:
Console.WriteLine("The value of a is, acc to case 3 is: " + a);
break;
default:
Console.WriteLine("Default value");
break;
}
Tutorial No. 11:
Click to WATCH the Series of Videos
// Loops in C#
for (int i = 0; i <= 5; i++) // i =i+1
{
// Console.WriteLine("Fahad Hussain");
Console.WriteLine(i);
for (int j = 0; j <= 5; j++)
{
Console.WriteLine(j);
}
}
//while
int b = 1;
while (b<=10)
{
Console.WriteLine("Fahad Hussain");
b++;
}
// do-while
int c = 12;
do
{
Console.WriteLine("Fahad Hussain");
c++;
} while (c<=10);
foreach (var item in collection)
{
}
Tutorial No. 12:
Click to WATCH the Series of Videos
//User Input in C#, (how to get user input in Console )
byte a;
short b;
int c;
long d;
float e;
double f;
a = Convert.ToByte(Console.ReadLine());
Console.WriteLine("The input value of a is: "+a);
b = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("The input value of a is: " + b);
Tutorial No. 13:
Click to WATCH the Series of Videos
//Array in C# (1d Array, 2d Array, Jagged Array)
int[] arr;
int[] arr1 = new int[5] {1,2,3,47,8 };
int[] arr2 = new int[] { 1, 2, 3, 47, 8,234,5,7,89};
int[] arr3 = new int[10];
int[] arr4 = new int[4];
//arr3[0] = 12;
//arr3[1] = 123;
//arr3[2] = 13;
//Console.WriteLine(arr3[0]);
//Console.WriteLine(arr2[0]);
for (int i = 0; i < arr3.Length; i++)
{
arr3[i] = Convert.ToInt32(Console.ReadLine());
// Console.WriteLine(arr3[i]);
}
foreach (var item in arr3)
{
Console.WriteLine(item);
}
Tutorial No. 14:
Click to WATCH the Series of Videos
// 2D Array
// 0 1 2
// 0 1 2 3
// 1 4 5 6
// 2 7 8 9
int[,] arr;
int[,] arr1 = new int[2,3] {
{1,2,3 },
{7,5,3 }
};
int[,] arr2 = new int[3,3] {
{1,2,3 },
{7,5,3 },
{7,5,7 }
};
int[,] arr3 = new int[2, 3];
foreach (var item in arr2)
{
Console.WriteLine(item);
}
Console.WriteLine("Data through For loop!");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
Console.WriteLine(arr2[i,j]);
}
}
int[,] arr3 = new int[2, 3];
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
arr3[i, j] = Convert.ToInt32(Console.ReadLine());
}
}
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 3; j++)
{
Console.Write(arr3[i, j] + " ");
}
if (i == 0)
{
Console.WriteLine();
}
}
Tutorial No. 15:
Click to WATCH the Series of Videos
// In c#, Jagged Array is an array whose elements are arrays with different dimensions and sizes.
// Sometimes jagged array called as “array of arrays” and it can store arrays instead of
// particular data type value.
// Jagged Array with Single Dimensional Array
int[][] jarray = new int[3][];
jarray[0] = new int[5] { 1, 2, 3, 4, 5 };
jarray[1] = new int[3] { 10, 20, 30 };
jarray[2] = new int[] { 12, 50, 60, 70, 32 };
// Jagged Array with Two Dimensional Array
int[][,] jarray1 = new int[3][,];
jarray1[0] = new int[2, 2] { { 15, 24 }, { 43, 54 } };
jarray1[1] = new int[,] { { 11, 12 }, { 13, 14 }, { 25, 26 } };
jarray1[2] = new int[4, 3];
int[][] arr = new int[2][];// Declare the array
arr[0] = new int[] { 11, 21, 56, 78 };// Initialize the array
arr[1] = new int[] { 42, 61, 37, 41, 59, 63 };
// Traverse array elements
for (int i = 0; i < arr.Length; i++)
{
for (int j = 0; j < arr[i].Length; j++)
{
System.Console.Write(arr[i][j] + " ");
}
System.Console.WriteLine();
}
Tutorial No. 16:
Click to WATCH the Series of Videos
//Type safe, convert(Class), casting (implict, explict), string(parse,tryparse)
int a = 12;
string b = "12";
int sum = a + Convert.ToInt32(b); //1212
Console.WriteLine(sum);
//Implict casting (low to high data types)
byte c = 13;
int d = c;
Console.WriteLine(d);
////Explict casting (high to low data types)
double cc = 134.123;
int dd = (int)cc;
Console.WriteLine(dd);
//int.parse
string a = "12345";
// int result = int.Parse(a);
//Console.WriteLine(result);
//int.tryparse
int r = 0;
bool res=int.TryParse(a, out r);
Console.WriteLine(res);
if (res)
{
Console.WriteLine("Right");
}
else
{
Console.WriteLine("Wrong");
}
Tutorial No. 17:
Click to WATCH the Series of Videos
//jump statement in C#
// break
// continue
// goto
// return
// throw
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
if(i==5)
{
break;
}
}
for (int i = 0; i < 10; i++)
{
if (i == 5)
{
continue;
}
Console.WriteLine(i);
}
Console.WriteLine("Goto Statement");
Console.WriteLine("Before Goto");
Console.WriteLine("After Goto");
goto statement;
statement:
{
Console.WriteLine("I am goto statement");
}
Tutorial No. 18:
Click to WATCH the Series of Videos
//Syntax Error
//console.WriteLine()
//Logical Error
for (int i = 0; i > 10; i++)
{
Console.WriteLine(i);
}
int a = 12;
int b = 0;
int result = a / b;
//Compile Time Error
Console.writeLine()
// Run Time Error
string r = Console.ReadLine();
int result = int.Parse(r);
Console.WriteLine("The Result is: "+result);
Try-catch Exception(Throw)
int aa = 12 / 0;
Tutorial No. 19:
Click to WATCH the Series of Videos
for (int i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
Console.WriteLine("End of Loop");
Tutorial No. 20:
Click to WATCH the Series of Videos
No Required of Code, Watch Video for better understanding...
Tutorial No. 21:
Click to WATCH the Series of Videos
Console.WriteLine("Process {0}",Debugger.IsAttached);
Tutorial No. 22:
Click to WATCH the Series of Videos
No Required of Code, Watch Video for better understanding...
Tutorial No. 23:
Click to WATCH the Series of Videos
class Program
{
static void Main(string[] args)
{
IT_Dept obj = new IT_Dept();
obj.EmpID = 12;
Console.WriteLine(obj.EmpID);
obj.Name = Console.ReadLine();
obj.Dept = Console.ReadLine();
obj.Salary = int.Parse(Console.ReadLine());
//Console.WriteLine(obj.Name);
//Console.WriteLine(obj.Dept);
//Console.WriteLine(obj.Salary);
obj.Info();
}
}
class IT_Dept
{
private int ID;
public int EmpID
{
get
{
return ID;
}
set
{
ID = value;
}
}
public string Name { get; set; }
public string Dept { get; set; }
public int Salary { get; set; }
public void Info()
{
Console.WriteLine("Name of Employee: "+Name);
Console.WriteLine("Dept of Employee: " + Dept);
Console.WriteLine("Salary of Employee: " + Salary);
}
}
Tutorial No. 24:
Click to WATCH the Series of Videos
Tutorial No. 25:
Click to WATCH the Series of Videos
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
IT_Dept obj = new IT_Dept();
obj.EmpID = 12;
Console.WriteLine(obj.EmpID);
obj.Name = Console.ReadLine();
obj.Dept = Console.ReadLine();
obj.Salary = int.Parse(Console.ReadLine());
//Console.WriteLine(obj.Name);
//Console.WriteLine(obj.Dept);
//Console.WriteLine(obj.Salary);
obj.Info();
}
}
class IT_Dept
{
private int ID;
public int EmpID
{
get
{
return ID;
}
set
{
ID = value;
}
}
public string Name { get; set; }
public string Dept { get; set; }
public int Salary { get; set; }
public void Info()
{
Console.WriteLine("Name of Employee: "+Name);
Console.WriteLine("Dept of Employee: " + Dept);
Console.WriteLine("Salary of Employee: " + Salary);
}
}
Tutorial No. 26:
Click to WATCH the Series of Videos
namespace Inheritance
{
class Program
{
static void Main(string[] args)
{
//B obj = new B();
//obj.AClasMethod();
C obj = new C();
obj.AClasMethod();
}
}
class A
{
public void AClasMethod()
{
Console.WriteLine("Method of class A");
}
}
class B : A
{
public void BClasMethod()
{
Console.WriteLine("Method of class B");
}
}
class C :A
{
}
// class D : A,B,C
// {
// }
}
Tutorial No. 27:
Click to WATCH the Series of Videos
its all about the Concept of Theory , watch till the end for better understanding...
Tutorial No. 28:
Click to WATCH the Series of Videos
namespace Constructor
{
class Program
{
static void Main(string[] args)
{
Employee obj = new Employee();
obj.EmpDetail();
Employee obj1 = new Employee(12, "FahadHussain");
obj1.EmpDetail();
Employee obj2 = new Employee(123, "Ali", 45.45);
obj2.EmpDetail();
}
}
class Employee
{
int Id;
string name;
double IDDept;
public Employee()
{
}
public Employee(int Id, string name)
{
this.Id = Id;
this.name = name;
}
public Employee(int Id, string name, double IDDept)
{
this.Id = Id;
this.name = name;
this.IDDept = IDDept;
}
public void EmpDetail()
{
Console.WriteLine("The Id of Employee: {0}",Id);
Console.WriteLine("The Name of Employee: {0}", name);
Console.WriteLine("The IDDept of Employee: {0}", IDDept);
}
}
Click to WATCH the Series of Videos
namespace Destructure
{
class Program
{
static void Main(string[] args)
{
A obj = new A(1,"Fahad");
obj.BioData();
A obj1 = new A(11, "Ali");
obj1.BioData();
}
}
class A
{
public int Id;
public string name;
public A(int Id, string name)
{
this.Id = Id;
this.name = name;
}
public void BioData()
{
Console.WriteLine("{0}",Id);
Console.WriteLine("{0}", name);
}
~A()
{
Console.WriteLine("Destrcutor Called!");
}
}
Tutorial No. 30:
Click to WATCH the Series of Videos
namespace Polymorphism_FunctionOverload
{
class Program
{
static void Main(string[] args)
{
Employee obj = new Employee();
obj.abc(12);
obj.abc(45.48);
obj.abc(45.23, 789);
}
}
class Employee
{
public void abc(int a)
{
Console.WriteLine(" int value {0}", a);
}
public void abc(double b)
{
Console.WriteLine(" Double value {0}",b);
}
public void abc(double b, int c)
{
Console.WriteLine(" Double value {0} and c is {1}", b,c);
}
}
Tutorial No. 31:
Click to WATCH the Series of Videos
namespace Operator_overload
{
class Program
{
static void Main(string[] args)
{
//Console.WriteLine(2 + 2);
//Console.WriteLine("Fahad" + "Hussain");
//Console.WriteLine(obj1 + obj2 =objj);
Emp obj1 = new Emp();
obj1.Id = 2;
obj1.name = "Fahad";
Emp obj2 = new Emp();
obj2.Id = 2;
obj2.name = "Hussain";
Emp obj3 = new Emp();
obj3 = obj1 + obj2;
Console.WriteLine(obj3.Id);
Console.WriteLine(obj3.name);
}
}
class Emp
{
public int Id = 0;
public string name = "";
public static Emp operator +(Emp obj1, Emp obj2)
{
Emp obj3 = new Emp();
obj3.Id = obj1.Id + obj2.Id;
obj3.name = obj1.name + obj2.name;
return obj3;
}
}
namespace Dynamic_polymorphism
{
class Program
{
static void Main(string[] args)
{
// ChildClass obj = new ChildClass();
// obj.method();
// BaseClass obj1 = new ChildClass();
// obj1.method();
//ChildClass obj = new ChildClass();
//obj.method();
BaseClass obj1 = new ChildClass();
obj1.method();
}
}
//class BaseClass
//{
// public void method()
// {
// Console.WriteLine("This is Base Class method");
// }
//}
//class ChildClass: BaseClass
//{
// public void method()
// {
// base.method();
// Console.WriteLine("This is Child Class method");
// }
//}
Tutorial No. 33:
Click to WATCH the Series of Videos
namespace Abstraction
{
class Program
{
static void Main(string[] args)
{
Bus obj = new Bus();
obj.Speed();
obj.HighWay();
Car obj1 = new Car();
obj1.Speed();
obj1.HighWay();
// Vehicle oo = new Vehicle();
}
}
abstract class Vehicle
{
public void HighWay()
{
Console.WriteLine("This is SimpleMethod in Abstact Class!");
}
public abstract void Speed();
}
class Car: Vehicle
{
public override void Speed()
{
Console.WriteLine("Car speed is over 80km/h!");
}
}
class Bus : Vehicle
{
public override void Speed()
{
Console.WriteLine("Bus speed is over 65km/h!");
}
}
}
Tutorial No. 34:
Click to WATCH the Series of Videos
namespace Interface
{
class Program
{
static void Main(string[] args)
{
D obj = new D();
obj.interfaceMethod1();
obj.interfaceMethod2();
obj.interfaceMethod3();
}
}
interface A
{
void interfaceMethod1();
}
interface B
{
void interfaceMethod2();
}
interface C:A,B
{
void interfaceMethod3();
}
class D:C
{
public void interfaceMethod1()
{
Console.WriteLine("Body of interfaceMethod1");
}
public void interfaceMethod2()
{
Console.WriteLine("Body of interfaceMethod2");
}
public void interfaceMethod3()
{
Console.WriteLine("Body of interfaceMethod3");
}
}
}
Tutorial No. 35:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Click to WATCH the Series of Videos
namespace Exceptional_Handling
{
class Program
{
static void Main(string[] args)
{
//Try
//Catch
//finally
//throw
//Console.WriteLine("Hello!");
//int a = 12;
//int b = 0;
//Console.WriteLine(c);
//Console.WriteLine("World!");
int a = 12;
int b = 0;
try
{
int c = a / b;
Console.WriteLine(c);
}
catch(DivideByZeroException ex)
{
Console.WriteLine("Zero in Not allowed!");
throw ex;
}
finally
{
Console.WriteLine("Finally keyword, Default!");
}
}
}
}
Tutorial No. 37:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Tutorial No. 38:
Click to WATCH the Series of Videos
int a=1;
Console.WriteLine(a);
object aa=12;
object bb=12;
object cc=(int)aa + 12;
Console.WriteLine(cc);
object dd =cc;
Console.WriteLine(dd);
var ab= 12;
var ac= ab +12;
dynamic ad = 12;
dynamic ae = ad + 12;
dynamic az = ae;
object aa=12;
Tutorial No. 39:
Click to WATCH the Series of Videos
namespace Structure
{
class Program
{
static void Main(string[] args)
{
A obj = new A();
//Console.WriteLine( obj.id = 12);
//Console.WriteLine(obj.name = "Fahad");
//obj.functionA();
obj.call(12, "Fahad");
obj.functionA();
float a = 12;
int* ptr = & a;
}
}
struct A
{
public int id;
public string name;
public void call(int id, string name)
{
this.id = id;
this.name = name;
}
public void functionA()
{
Console.WriteLine(id);
Console.WriteLine(name);
}
}
}
Tutorial No. 40:
Click to WATCH the Series of Videos
// its all about differences, just watch the video till end for better understanding...
Tutorial No. 41:
Click to WATCH the Series of Videos
namespace Enum
{
class Program
{
enum months
{
jan,
feb,
march,
april,
may,
june,
july,
august,
sep,
oct,
nov,
dec
}
static void Main(string[] args)
{
// Console.WriteLine( months.august);
// Console.WriteLine( (double)months.august);
// Console.WriteLine(months.GetName(typeof(months),8));
//// Console.WriteLine("months constant names:");
// foreach (string str in months.GetNames(typeof(months)))
// Console.WriteLine(str);
Console.WriteLine(3+3);
Console.WriteLine("Fahad"+"Hussain");
}
}
}
Tutorial No. 42:
Click to WATCH the Series of Videos
//int num = 23; // value type is int and assigned value 23
//object Obj = num; // Boxing
//int i = (int)Obj; // Unboxing
Tutorial No. 43:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
A obj = new A();
Console.WriteLine(obj.a);
Console.WriteLine(obj.name);
obj.Login();
}
}
public partial class A
{
public int a =12;
public string name="Ali"
}
public partial class A
{
public void Login()
{
Console.WriteLine("login method in Class A");
}
}
}
Tutorial No. 44:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
ClassA obj = new ClassA();
obj.SetSalary();
}
}
//public partial class ClassA
//{
// partial void SetData();
//}
//public partial class ClassA
//{
// public void SetSalary()
// {
// SetData();
// // Perform other functionality here
// }
// partial void SetData()
// {
// Console.Write("This is partial method.");
// Console.ReadKey();
}
}
}
Tutorial No. 45:
Click to WATCH the Series of Videos
First Concept of Sealed Class,
//class A
//{
//}
//sealed class B :A
//{
//}
//sealed class C :B
//{
//}
//class D : B
//{
//}
Second Concept of Sealed Class,
namespace Advance_C_Sharp
{
class Program
{
static void Main(string[] args)
{
//A obj = new A();
//Console.WriteLine(obj.a);
//Console.WriteLine(obj.name);
//obj.Login();
//Employee obj = new Employee();
//obj.Show();
//obj.login();
//Employee obj1 = new Dept();
//obj1.Show();
//obj1.login();
//Employee obj2 = new Salary();
//obj2.Show();
// obj2.login();
}
}
//class Employee
//{
// public virtual void Show()
// {
// Console.WriteLine("Show method in Employee Class");
// }
// public virtual void login()
// {
// Console.WriteLine("login method in Employee Class");
// }
//}
//class Dept: Employee
//{
// sealed public override void Show()
// {
// Console.WriteLine("Show method in Dept Class");
// }
// public override void login()
// {
// Console.WriteLine("login method in Dept Class");
// }
//}
//class Salary: Dept
//{
// public override void login()
// {
// Console.WriteLine("login method in Salary Class");
// }
//}
}
Tutorial No. 46:
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
//int i = 10;
//bool result = i.IsGreaterThan(100);
//Console.WriteLine(result);
}
}
//public static class IntExtensions
//{
// public static bool IsGreaterThan(this int i, int value)
// {
// return i > value;
// }
//}
}
}
Click to WATCH the Series of Videos
namespace Advance_CSharp
{
class Program
{
static void Main(string[] args)
{
public int Add(int a, int b)
{
return a + b;
}
Console.WriteLine(sum(2,3));
}
}
}
Tutorial No. 48:
Click to WATCH the Series of Videos
namespace Advance_C_Sharp
{
class Program
{
static void Main(string[] args)
{
//is =is it you?
//int a = 12;
//if(a is string)
//{
// Console.WriteLine("False");
//}
//as = Asim, do work as like Ali
//object z = 159;
//string aa = z as string;
}
}
}
Tutorial No. 49:
Click to WATCH the Series of Videos
namespace ConsoleApplication6
{
class Program
{
//const compile time
//readonly runtime
// const int a = 12;
static void Main(string[] args)
{
//a = 123;
//Console.WriteLine(a);
A obj = new A(45);
}
}
class A
{
readonly int b;
public A(int bb)
{
this.b = bb;
Console.WriteLine(b);
}
}
}
nice work fahad bro
ReplyDelete