Posts

Record

 // See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); var std = new Student("Sabir", 21); Console.WriteLine("Name=" + std.Name); //std.Name = "Tejas"; var std2 = std with { Name = "Tejas", age = 22 }; Console.WriteLine("Name=" + std.Name); Console.WriteLine("Name=" + std2.Name); public record Student(string Name, int age);

get Set

Image
 

inheritance, get set

 using System; using System.Collections.Generic; using System.Text; namespace Inhereitance {     //Dad     class BaseClass     {         private int creditCard = 1234;//{get;set;}         public void PrintNumber()         {             Console.WriteLine("OldPin Credit Card=" + creditCard);         }         public int Sabir()         {             return creditCard;         }         public int getSetCredit        {             get {return creditCard; }             set{creditCard = value;}             }         public void ChangePin(int newpin)         {           ...

Class, Constructor

 using System; using System.Collections.Generic; using System.Text; namespace ConsoleApp2 {      class Demo     {         public Demo()         {             Console.WriteLine("Constructor");             Sum();         }         public Demo(String name)         {             Console.WriteLine("Name=" + name);         }                  //Destructor De Alocate memory          ~Demo()         {             Console.WriteLine("Destructor");         }         public int number = 10;        public void Sum()        {             Co...

Method Function

 using System; using System.Collections.Generic; using System.Net.Http; using System.Text; namespace ConsoleApp2 {         class Program     {        struct Student         {            public String name;            public int age;         };         int a=12;         enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };        static  void Main(string[] args)         {             Test1();             Test2("sabir",12);//call                  Console.WriteLine("Sum=" + addition());             Console.WriteLine("Mul=" + mul(12,2));         }         //1. Without return without par...

Method

 using System; using System.Collections.Generic; using System.Net.Http; namespace ConsoleApp2 {         class Program     {        struct Student         {            public String name;            public int age;         };             int a=12;         enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat };        static  void Main(string[] args)         {             Program obj = new Program();             obj.Test1();             String name = "Computer";             obj.Test2("sabir",12);//call         }         //1. Without return without parameter         v...