├── .gitattributes ├── .gitignore ├── 16_Strings ├── 16_Strings.csproj ├── 16_Strings.sln ├── App.config ├── ExampleCase.cs ├── ExampleCompare.cs ├── ExampleContains.cs ├── ExampleCreate.cs ├── ExampleJoin.cs ├── ExampleSubstring.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 20_Inheritance ├── 20_Inheritance.csproj ├── 20_Inheritance.sln ├── App.config ├── Example1 │ ├── Rectangle.cs │ └── Shape.cs ├── Example2 │ ├── Rectangle.cs │ └── TableTop.cs ├── Example3 │ ├── PaintCost.cs │ ├── Rectangle.cs │ └── Shape.cs ├── ExampleMultipleInheritance.cs ├── ExampleParentChild.cs ├── ExampleParentInitialize.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 21_Polymorphism ├── 21_Polymorphism.csproj ├── 21_Polymorphism.sln ├── App.config ├── ExampleAbstractClass.cs ├── ExampleFunctionOverloading.cs ├── ExamplePolymorphism.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 23_Interfaces ├── 23_Interfaces.sln └── 23_Interfaces │ ├── 23_Interfaces.csproj │ ├── App.config │ ├── Example1 │ ├── ExampleTransaction.cs │ ├── ITransaction.cs │ └── Transaction.cs │ ├── Example2 │ ├── ExampleGoat.cs │ ├── Goat.cs │ └── IAnimal.cs │ ├── Example3 │ └── DemoClass.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── method_signature.cpp ├── 28_FileIO ├── 28_FileIO.csproj ├── 28_FileIO.sln ├── App.config ├── ExampleBinary.cs ├── ExampleDirectory.cs ├── ExampleFileStream.cs ├── ExampleStreamReader.cs ├── ExampleStreamWriter.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── jamaica.txt ├── 33_Delegates ├── 33_Delegates.csproj ├── 33_Delegates.sln ├── App.config ├── ExampleDelegate.cs ├── ExampleDelegateUsage.cs ├── ExampleMulticastDelegate.cs ├── ExampleTimer.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 34_Events ├── 34_Events.csproj ├── 34_Events.sln ├── App.config ├── ExampleEvent.cs ├── ExampleForm.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 35_Collections ├── 35_Collections.csproj ├── 35_Collections.sln ├── App.config ├── ExampleArrayList.cs ├── ExampleBitArray.cs ├── ExampleHashtable.cs ├── ExampleQueue.cs ├── ExampleSortedList.cs ├── ExampleStack.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 36_Generics ├── 36_Generics.csproj ├── 36_Generics.sln ├── App.config ├── ExampleGenericArray.cs ├── ExampleGenericFunction.cs ├── GenericArray.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── 39_Multithreading ├── 39_Multithreading.csproj ├── 39_Multithreading.sln ├── App.config ├── ExampleCreate.cs ├── ExampleCreateMultiple.cs ├── ExampleDestroy.cs ├── ExampleMain.cs ├── ExampleManage.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── BzuShopDatabase ├── BzuShopERD.PNG ├── db_create_tables.sql ├── db_insert_data.sql └── db_select_data.sql ├── C# Tutorial (PDF Version) - Tutorials Point.pdf ├── ConsoleAppFirst ├── App.config ├── ConsoleAppFirst.csproj ├── ConsoleAppFirst.sln ├── ExampleClass.cs ├── ExampleEnum.cs ├── ExampleExceptions.cs ├── ExampleNullable.cs ├── ExampleTypeConversion.cs ├── InvalidPinException.cs ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── Inheritance.pdf ├── Inheritance ├── Inheritance.sln └── Inheritance │ ├── App.config │ ├── Inheritance.csproj │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── With │ ├── Example.cs │ └── WithInheritance.cs │ ├── WithConstructor │ ├── Example.cs │ └── WithConstructor.cs │ └── Without │ └── WithoutInheritance.cs ├── Interfaces.pdf ├── Interfaces ├── Interfaces.sln └── Interfaces │ ├── App.config │ ├── Example.cs │ ├── ExampleClasses.cs │ ├── ExampleInterfaces.cs │ ├── Interfaces.csproj │ ├── Program.cs │ └── Properties │ └── AssemblyInfo.cs ├── LICENSE ├── LINQ.pdf ├── OrderApp ├── OrderApp.Data │ ├── Database.cs │ ├── Item.cs │ ├── Order.cs │ ├── OrderApp.Data.csproj │ ├── OrderItem.cs │ ├── OrderManager.cs │ ├── PDFGenerator.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ ├── db.sql │ └── packages.config ├── OrderApp.Setup │ └── OrderApp.Setup.vdproj ├── OrderApp.SetupWix │ ├── OrderApp.SetupWix.wixproj │ ├── Product.wxs │ ├── Resources │ │ ├── BackgroundLogo.jpg │ │ ├── TopBanner.jpg │ │ └── eula.rtf │ └── readme.md ├── OrderApp.sln └── OrderApp │ ├── App.config │ ├── ItemForm.Designer.cs │ ├── ItemForm.cs │ ├── ItemForm.resx │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── OrderApp.csproj │ ├── OrderForm.Designer.cs │ ├── OrderForm.cs │ ├── OrderForm.resx │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ └── logo.ico ├── Programming ├── Programming.sln └── Programming │ ├── App.config │ ├── Calculator.cs │ ├── Program.cs │ ├── Programming.csproj │ └── Properties │ └── AssemblyInfo.cs ├── QRCodeApp ├── QRCodeApp.sln └── QRCodeApp │ ├── App.config │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── QRCodeApp.csproj │ └── packages.config ├── README.md ├── StudentAdmissionSystem ├── StudentAdmissionSystem.Data │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Student.cs │ ├── StudentAdmissionSystem.Data.csproj │ └── StudentManager.cs ├── StudentAdmissionSystem.sln └── StudentAdmissionSystem │ ├── App.config │ ├── Program.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── StudentAdmissionSystem.csproj │ ├── frmLogin.Designer.cs │ ├── frmLogin.cs │ ├── frmLogin.resx │ ├── frmProfile.Designer.cs │ ├── frmProfile.cs │ ├── frmProfile.resx │ ├── frmQulification.Designer.cs │ ├── frmQulification.cs │ └── frmQulification.resx ├── WinformsAppFirst ├── App.config ├── Dashboard.Designer.cs ├── Dashboard.cs ├── Dashboard.resx ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── WinformsAppFirst.csproj └── WinformsAppFirst.sln └── WpfAppFirst ├── WpfAppFirst.sln └── WpfAppFirst ├── App.xaml ├── App.xaml.cs ├── AssemblyInfo.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs └── WpfAppFirst.csproj /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /16_Strings/16_Strings.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D34FCF06-BE6A-4E73-AA0C-A54A62AA1911} 8 | Exe 9 | _16_Strings 10 | 16_Strings 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /16_Strings/16_Strings.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "16_Strings", "16_Strings.csproj", "{D34FCF06-BE6A-4E73-AA0C-A54A62AA1911}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D34FCF06-BE6A-4E73-AA0C-A54A62AA1911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D34FCF06-BE6A-4E73-AA0C-A54A62AA1911}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D34FCF06-BE6A-4E73-AA0C-A54A62AA1911}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D34FCF06-BE6A-4E73-AA0C-A54A62AA1911}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {4CBE1C21-0F56-486A-8278-F9EB8AE7C189} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /16_Strings/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /16_Strings/ExampleCase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleCase 10 | { 11 | public void Run() 12 | { 13 | string name = "Kashif Hussain"; 14 | 15 | Console.WriteLine(name.ToUpper()); 16 | Console.WriteLine(name.ToLower()); 17 | 18 | Console.ReadLine(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /16_Strings/ExampleCompare.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleCompare 10 | { 11 | public void Run() 12 | { 13 | string str1 = "BS(IT)"; 14 | string str2 = "BSIT"; 15 | if (String.Compare(str1, str2) == 0) 16 | { 17 | Console.WriteLine(str1 + " and " + str2 + " are equal."); 18 | } 19 | else 20 | { 21 | Console.WriteLine(str1 + " and " + str2 + " are not equal."); 22 | } 23 | Console.ReadKey(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /16_Strings/ExampleContains.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleContains 10 | { 11 | public void Run() 12 | { 13 | string str = "Welcome to BS(IT)"; 14 | if (str.Contains("to")) 15 | { 16 | Console.WriteLine("String contains 'to'."); 17 | } 18 | Console.ReadKey(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /16_Strings/ExampleCreate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleCreate 10 | { 11 | public void Run() 12 | { 13 | //from string literal and string concatenation 14 | string fname, lname; 15 | fname = "Rowan"; 16 | lname = "Atkinson"; 17 | string fullname = fname + lname; 18 | Console.WriteLine("Full Name: {0}", fullname); 19 | 20 | //by using string constructor 21 | char[] letters = { 'H', 'e', 'l', 'l', 'o' }; 22 | string greetings = new string(letters); 23 | Console.WriteLine("Greetings: {0}", greetings); 24 | 25 | //methods returning string 26 | string[] sarray = { "Hello", "From", "Tutorials", "Point" }; 27 | string message = String.Join(" ", sarray); 28 | Console.WriteLine("Message: {0}", message); 29 | 30 | //formatting method to convert a value 31 | DateTime waiting = new DateTime(2012, 10, 10, 17, 58, 1); 32 | string chat = String.Format("Message sent at {0:t} on {0:D}",waiting); 33 | Console.WriteLine("Message: {0}", chat); 34 | 35 | Console.ReadKey(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /16_Strings/ExampleJoin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleJoin 10 | { 11 | public void Run() 12 | { 13 | string[] starray = new string[]{"Down the way nights are dark", 14 | "And the sun shines daily on the mountain top", 15 | "I took a trip on a sailing ship", 16 | "And when I reached Jamaica", 17 | "I made a stop"}; 18 | 19 | string str = String.Join("\n", starray); 20 | Console.WriteLine(str); 21 | 22 | Console.ReadKey(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /16_Strings/ExampleSubstring.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | public class ExampleSubstring 10 | { 11 | public void Run() 12 | { 13 | string str = "Welcome to BS(IT)"; 14 | Console.WriteLine(str); 15 | 16 | string substr = str.Substring(11); 17 | Console.WriteLine(substr); 18 | 19 | Console.ReadKey(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /16_Strings/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _16_Strings 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | ExampleCreate exampleCreate = new ExampleCreate(); 14 | exampleCreate.Run(); 15 | 16 | //ExampleCompare exampleCompare = new ExampleCompare(); 17 | //exampleCompare.Run(); 18 | 19 | //ExampleContains exampleContains = new ExampleContains(); 20 | //exampleContains.Run(); 21 | 22 | //ExampleSubstring exampleSubstring = new ExampleSubstring(); 23 | //exampleSubstring.Run(); 24 | 25 | //ExampleJoin exampleJoin = new ExampleJoin(); 26 | //exampleJoin.Run(); 27 | 28 | // ExampleCase exampleCase = new ExampleCase(); 29 | // exampleCase.Run(); 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /16_Strings/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("16_Strings")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("16_Strings")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d34fcf06-be6a-4e73-aa0c-a54a62aa1911")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /20_Inheritance/20_Inheritance.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "20_Inheritance", "20_Inheritance.csproj", "{20FF6A00-E907-472F-B1AA-3B24378D8360}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {20FF6A00-E907-472F-B1AA-3B24378D8360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {20FF6A00-E907-472F-B1AA-3B24378D8360}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {20FF6A00-E907-472F-B1AA-3B24378D8360}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {20FF6A00-E907-472F-B1AA-3B24378D8360}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {77FDDC78-45B9-4656-A9E8-239FD36C835D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /20_Inheritance/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /20_Inheritance/Example1/Rectangle.cs: -------------------------------------------------------------------------------- 1 | namespace _20_Inheritance.Example1 2 | { 3 | // Derived class 4 | class Rectangle : Shape 5 | { 6 | public int getArea() 7 | { 8 | return (width * height); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /20_Inheritance/Example1/Shape.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance.Example1 8 | { 9 | class Shape 10 | { 11 | public void setWidth(int w) 12 | { 13 | width = w; 14 | } 15 | public void setHeight(int h) 16 | { 17 | height = h; 18 | } 19 | protected int width; 20 | protected int height; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /20_Inheritance/Example2/Rectangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace _20_Inheritance.Example2 4 | { 5 | class Rectangle 6 | { 7 | //member variables 8 | protected double length; 9 | protected double width; 10 | public Rectangle(double l, double w) 11 | { 12 | length = l; 13 | width = w; 14 | } 15 | public double GetArea() 16 | { 17 | return length * width; 18 | } 19 | public void Display() 20 | { 21 | Console.WriteLine("Length: {0}", length); 22 | Console.WriteLine("Width: {0}", width); 23 | Console.WriteLine("Area: {0}", GetArea()); 24 | } 25 | }//end class Rectangle 26 | } 27 | -------------------------------------------------------------------------------- /20_Inheritance/Example2/TableTop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance.Example2 8 | { 9 | class Tabletop : Rectangle 10 | { 11 | private double cost; 12 | public Tabletop(double l, double w) : base(l, w) 13 | { 14 | } 15 | 16 | public double GetCost() 17 | { 18 | double cost; 19 | cost = GetArea() * 70; 20 | return cost; 21 | } 22 | public void Display() 23 | { 24 | base.Display(); 25 | Console.WriteLine("Cost: {0}", GetCost()); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /20_Inheritance/Example3/PaintCost.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance.Example3 8 | { 9 | // interface PaintCost 10 | public interface PaintCost 11 | { 12 | int getCost(int area); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /20_Inheritance/Example3/Rectangle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance.Example3 8 | { 9 | // Derived class 10 | class Rectangle : Shape, PaintCost 11 | { 12 | public int getArea() 13 | { 14 | return (width * height); 15 | } 16 | 17 | public int getCost(int area) 18 | { 19 | return area * 70; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /20_Inheritance/Example3/Shape.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance.Example3 8 | { 9 | class Shape 10 | { 11 | public void setWidth(int w) 12 | { 13 | width = w; 14 | } 15 | public void setHeight(int h) 16 | { 17 | height = h; 18 | } 19 | protected int width; 20 | protected int height; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /20_Inheritance/ExampleMultipleInheritance.cs: -------------------------------------------------------------------------------- 1 | using _20_Inheritance.Example3; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace _20_Inheritance 9 | { 10 | public class ExampleMultipleInheritance 11 | { 12 | public void Run() 13 | { 14 | Rectangle Rect = new Rectangle(); 15 | int area; 16 | Rect.setWidth(5); 17 | Rect.setHeight(7); 18 | area = Rect.getArea(); 19 | 20 | // Print the area of the object. 21 | Console.WriteLine("Total area: {0}", Rect.getArea()); 22 | Console.WriteLine("Total paint cost: ${0}", Rect.getCost(area)); 23 | Console.ReadKey(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /20_Inheritance/ExampleParentChild.cs: -------------------------------------------------------------------------------- 1 | using _20_Inheritance.Example1; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace _20_Inheritance 9 | { 10 | public class ExampleParentChild 11 | { 12 | public void Run() 13 | { 14 | Rectangle obj = new Rectangle(); 15 | obj.setWidth(5); 16 | obj.setHeight(7); 17 | // Print the area of the object. 18 | Console.WriteLine("Total area: {0}", obj.getArea()); 19 | Console.ReadKey(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /20_Inheritance/ExampleParentInitialize.cs: -------------------------------------------------------------------------------- 1 | using _20_Inheritance.Example2; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace _20_Inheritance 9 | { 10 | public class ExampleParentInitialize 11 | { 12 | public void Run() 13 | { 14 | Tabletop t = new Tabletop(4.5, 7.5); 15 | t.Display(); 16 | Console.ReadLine(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /20_Inheritance/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _20_Inheritance 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | //ExampleParentChild exampleParentChild = new ExampleParentChild(); 14 | //exampleParentChild.Run(); 15 | 16 | //ExampleParentInitialize exampleParentInitialize = new ExampleParentInitialize(); 17 | //exampleParentInitialize.Run(); 18 | 19 | ExampleMultipleInheritance exampleMultipleInheritance = new ExampleMultipleInheritance(); 20 | exampleMultipleInheritance.Run(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /20_Inheritance/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("20_Inheritance")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("20_Inheritance")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("20ff6a00-e907-472f-b1aa-3b24378d8360")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /21_Polymorphism/21_Polymorphism.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A890C6CA-286A-4032-9838-FAE28F16EB9B} 8 | Exe 9 | _21_Polymorphism 10 | 21_Polymorphism 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /21_Polymorphism/21_Polymorphism.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "21_Polymorphism", "21_Polymorphism.csproj", "{A890C6CA-286A-4032-9838-FAE28F16EB9B}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {A890C6CA-286A-4032-9838-FAE28F16EB9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A890C6CA-286A-4032-9838-FAE28F16EB9B}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A890C6CA-286A-4032-9838-FAE28F16EB9B}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A890C6CA-286A-4032-9838-FAE28F16EB9B}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {AA898265-DBDA-44B2-AA45-367B833CA8C7} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /21_Polymorphism/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /21_Polymorphism/ExampleAbstractClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _21_Polymorphism 8 | { 9 | public class ExampleAbstractClass 10 | { 11 | public void Run() 12 | { 13 | Rectangle r = new Rectangle(10, 7); 14 | double a = r.area(); 15 | Console.WriteLine("Area: {0}", a); 16 | Console.ReadKey(); 17 | } 18 | } 19 | 20 | abstract class Shape 21 | { 22 | public abstract int area(); 23 | } 24 | 25 | class Rectangle : Shape 26 | { 27 | private int length; 28 | private int width; 29 | 30 | public Rectangle(int a = 0, int b = 0) 31 | { 32 | length = a; 33 | width = b; 34 | } 35 | 36 | public override int area() 37 | { 38 | Console.WriteLine("Rectangle class area :"); 39 | return (width * length); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /21_Polymorphism/ExampleFunctionOverloading.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _21_Polymorphism 8 | { 9 | public class ExampleFunctionOverloading 10 | { 11 | public void Run() 12 | { 13 | Printdata p = new Printdata(); 14 | 15 | // Call print to print integer 16 | p.print(5); 17 | 18 | // Call print to print float 19 | p.print(500.263); 20 | 21 | // Call print to print string 22 | p.print("Hello C#"); 23 | 24 | Console.ReadKey(); 25 | } 26 | } 27 | 28 | public class Printdata 29 | { 30 | public void print(int i) 31 | { 32 | Console.WriteLine("Printing int: {0}", i); 33 | } 34 | 35 | public void print(double f) 36 | { 37 | Console.WriteLine("Printing float: {0}", f); 38 | } 39 | 40 | public void print(string s) 41 | { 42 | Console.WriteLine("Printing string: {0}", s); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /21_Polymorphism/ExamplePolymorphism.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _21_Polymorphism 8 | { 9 | public class ExamplePolymorphism 10 | { 11 | public void Run() 12 | { 13 | //Rectangle r = new Rectangle(10, 7); 14 | Shape r = new Rectangle(10, 7); 15 | 16 | //Triangle t = new Triangle(10, 5); 17 | Shape t = new Triangle(10, 5); 18 | 19 | Console.WriteLine("Rectangle Area: {0}", r.area()); 20 | Console.WriteLine("Triangle Area: {0}", t.area()); 21 | 22 | Console.ReadKey(); 23 | } 24 | 25 | class Shape 26 | { 27 | protected int width, height; 28 | public Shape(int a = 0, int b = 0) 29 | { 30 | width = a; 31 | height = b; 32 | } 33 | public virtual int area() 34 | { 35 | Console.WriteLine("Parent class area :"); 36 | return 0; 37 | } 38 | } 39 | 40 | class Rectangle : Shape 41 | { 42 | public Rectangle(int a = 0, int b = 0) : base(a, b) 43 | { 44 | } 45 | public override int area() 46 | { 47 | Console.WriteLine("Rectangle class area :"); 48 | return (width * height); 49 | } 50 | } 51 | 52 | class Triangle : Shape 53 | { 54 | public Triangle(int a = 0, int b = 0) : base(a, b) 55 | { 56 | } 57 | public override int area() 58 | { 59 | Console.WriteLine("Triangle class area :"); 60 | return (width * height / 2); 61 | } 62 | } 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /21_Polymorphism/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _21_Polymorphism 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | ExampleFunctionOverloading exampleFunctionOverloading = new ExampleFunctionOverloading(); 14 | exampleFunctionOverloading.Run(); 15 | 16 | //ExampleAbstractClass exampleAbstractClass = new ExampleAbstractClass(); 17 | //exampleAbstractClass.Run(); 18 | 19 | //ExamplePolymorphism examplePolymorphism = new ExamplePolymorphism(); 20 | //examplePolymorphism.Run(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /21_Polymorphism/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("21_Polymorphism")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("21_Polymorphism")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a890c6ca-286a-4032-9838-fae28f16eb9b")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32319.34 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "23_Interfaces", "23_Interfaces\23_Interfaces.csproj", "{2FC0C60D-5538-4D07-9397-14892BE3FA5D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2FC0C60D-5538-4D07-9397-14892BE3FA5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {2FC0C60D-5538-4D07-9397-14892BE3FA5D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {2FC0C60D-5538-4D07-9397-14892BE3FA5D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {2FC0C60D-5538-4D07-9397-14892BE3FA5D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {45DB59CF-29DF-441B-9FDE-9F6AA59A78AA} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example1/ExampleTransaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example1 8 | { 9 | public class ExampleTransaction 10 | { 11 | public void Run() 12 | { 13 | ITransaction t1 = new Transaction("001", "8/10/2012", 78900.00); 14 | Transaction t2 = new Transaction("002", "9/10/2012", 451900.00); 15 | t1.showTransaction(); 16 | t2.showTransaction(); 17 | Console.ReadKey(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example1/ITransaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example1 8 | { 9 | public interface ITransaction 10 | { 11 | // interface members 12 | void showTransaction(); 13 | double getAmount(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example1/Transaction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example1 8 | { 9 | public class Transaction : ITransaction 10 | { 11 | private string tCode; 12 | private string date; 13 | private double amount; 14 | public Transaction() 15 | { 16 | tCode = " "; 17 | date = " "; 18 | amount = 0.0; 19 | } 20 | public Transaction(string c, string d, double a) 21 | { 22 | tCode = c; 23 | date = d; 24 | amount = a; 25 | } 26 | public double getAmount() 27 | { 28 | return amount; 29 | } 30 | public void showTransaction() 31 | { 32 | Console.WriteLine("\n"); 33 | 34 | Console.WriteLine("Transaction: {0}", tCode); 35 | Console.WriteLine("Date: {0}", date); 36 | Console.WriteLine("Amount: {0}", getAmount()); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example2/ExampleGoat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example2 8 | { 9 | /// 10 | /// Source : https://www.w3schools.com/cs/cs_interface.php 11 | /// 12 | public class ExampleGoat 13 | { 14 | public void Run() 15 | { 16 | Goat goat = new Goat(); // Create a Goat object 17 | goat.animalSound(); 18 | goat.run(); 19 | 20 | Console.ReadKey(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example2/Goat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example2 8 | { 9 | public class Goat : IAnimal 10 | { 11 | public void animalSound() 12 | { 13 | // The body of animalSound() is provided here 14 | Console.WriteLine("The Goat says: baah baah."); 15 | } 16 | 17 | public void run() 18 | { 19 | Console.WriteLine("The Goat runs fast."); 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example2/IAnimal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example2 8 | { 9 | // interface 10 | interface IAnimal 11 | { 12 | void animalSound(); // interface method (does not have a body) 13 | void run(); // interface method (does not have a body) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Example3/DemoClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _23_Interfaces.Example3 8 | { 9 | /// 10 | /// Source : https://www.w3schools.com/cs/cs_interface.php 11 | /// 12 | interface IFirstInterface 13 | { 14 | void myMethod(); // interface method 15 | } 16 | 17 | interface ISecondInterface 18 | { 19 | void myOtherMethod(); // interface method 20 | } 21 | 22 | // Implement multiple interfaces 23 | class DemoClass : IFirstInterface, ISecondInterface 24 | { 25 | public void Run() 26 | { 27 | myMethod(); 28 | myOtherMethod(); 29 | 30 | Console.ReadKey(); 31 | } 32 | 33 | public void myMethod() 34 | { 35 | Console.WriteLine("Some text.."); 36 | } 37 | 38 | public void myOtherMethod() 39 | { 40 | Console.WriteLine("Some other text..."); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Program.cs: -------------------------------------------------------------------------------- 1 | using _23_Interfaces.Example1; 2 | using _23_Interfaces.Example2; 3 | using _23_Interfaces.Example3; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace _23_Interfaces 11 | { 12 | internal class Program 13 | { 14 | static void Main(string[] args) 15 | { 16 | ExampleTransaction exampleTransaction = new ExampleTransaction(); 17 | exampleTransaction.Run(); 18 | 19 | //ExampleGoat exampleGoat = new ExampleGoat(); 20 | //exampleGoat.Run(); 21 | 22 | //DemoClass myObj = new DemoClass(); 23 | //myObj.Run(); 24 | 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("23_Interfaces")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("23_Interfaces")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2fc0c60d-5538-4d07-9397-14892be3fa5d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /23_Interfaces/23_Interfaces/method_signature.cpp: -------------------------------------------------------------------------------- 1 | // Method Declaration or Method Signature 2 | int add(int x, int y); 3 | 4 | int main() { 5 | 6 | } 7 | 8 | // Method Defination or Actual Code 9 | int add(int x, int y) { 10 | return x + y; 11 | } 12 | -------------------------------------------------------------------------------- /28_FileIO/28_FileIO.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31613.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "28_FileIO", "28_FileIO.csproj", "{9FA8810B-1BE3-4784-819F-4CB5E8E165CE}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {9FA8810B-1BE3-4784-819F-4CB5E8E165CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {9FA8810B-1BE3-4784-819F-4CB5E8E165CE}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {9FA8810B-1BE3-4784-819F-4CB5E8E165CE}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {9FA8810B-1BE3-4784-819F-4CB5E8E165CE}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {970AFC88-F76E-467F-A068-0A9CED19D3D4} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /28_FileIO/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /28_FileIO/ExampleBinary.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | public class ExampleBinary 7 | { 8 | public void Run() 9 | { 10 | BinaryWriter bw; 11 | BinaryReader br; 12 | int i = 25; 13 | double d = 3.14157; 14 | bool b = true; 15 | string s = "I am happy"; 16 | 17 | //create the file 18 | try 19 | { 20 | bw = new BinaryWriter(new FileStream("mydata", FileMode.Create)); 21 | } 22 | catch (IOException e) 23 | { 24 | Console.WriteLine(e.Message + "\n Cannot create file."); 25 | return; 26 | } 27 | 28 | //writing into the file 29 | try 30 | { 31 | bw.Write(i); 32 | bw.Write(d); 33 | bw.Write(b); 34 | bw.Write(s); 35 | } 36 | catch (IOException e) 37 | { 38 | Console.WriteLine(e.Message + "\n Cannot write to file."); 39 | return; 40 | } 41 | bw.Close(); 42 | 43 | //reading from the file 44 | try 45 | { 46 | br = new BinaryReader(new FileStream("mydata", FileMode.Open)); 47 | } 48 | catch (IOException e) 49 | { 50 | Console.WriteLine(e.Message + "\n Cannot open file."); 51 | return; 52 | } 53 | try 54 | { 55 | i = br.ReadInt32(); 56 | Console.WriteLine("Integer data: {0}", i); 57 | d = br.ReadDouble(); 58 | Console.WriteLine("Double data: {0}", d); 59 | b = br.ReadBoolean(); 60 | Console.WriteLine("Boolean data: {0}", b); 61 | s = br.ReadString(); 62 | Console.WriteLine("String data: {0}", s); 63 | } 64 | catch (IOException e) 65 | { 66 | Console.WriteLine(e.Message + "\n Cannot read from file."); 67 | return; 68 | } 69 | br.Close(); 70 | Console.ReadKey(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /28_FileIO/ExampleDirectory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | public class ExampleDirectory 7 | { 8 | public void Run() 9 | { 10 | //creating a DirectoryInfo object 11 | DirectoryInfo mydir = new DirectoryInfo(@"c:\Windows"); 12 | // getting the files in the directory, their names and size 13 | FileInfo[] f = mydir.GetFiles(); 14 | foreach (FileInfo file in f) 15 | { 16 | Console.WriteLine("File Name: {0} Size: {1}", file.Name, file.Length); 17 | } 18 | Console.ReadKey(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /28_FileIO/ExampleFileStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | public class ExampleFileStream 7 | { 8 | public void Run() 9 | { 10 | FileStream F = new FileStream("test.dat", FileMode.OpenOrCreate, FileAccess.ReadWrite); 11 | for (int i = 1; i <= 20; i++) 12 | { 13 | F.WriteByte((byte)i); 14 | } 15 | 16 | F.Position = 0; 17 | for (int i = 0; i <= 20; i++) 18 | { 19 | Console.Write(F.ReadByte() + " "); 20 | } 21 | F.Close(); 22 | 23 | Console.ReadKey(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /28_FileIO/ExampleStreamReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | public class ExampleStreamReader 7 | { 8 | public void Run() 9 | { 10 | try 11 | { 12 | // Create an instance of StreamReader to read from a file. 13 | // The using statement also closes the StreamReader. 14 | using (StreamReader sr = new StreamReader("jamaica.txt")) 15 | { 16 | string line; 17 | // Read and display lines from the file until 18 | // the end of the file is reached. 19 | while ((line = sr.ReadLine()) != null) 20 | { 21 | Console.WriteLine(line); 22 | } 23 | } 24 | } 25 | catch (Exception e) 26 | { 27 | // Let the user know what went wrong. 28 | Console.WriteLine("The file could not be read:"); 29 | Console.WriteLine(e.Message); 30 | } 31 | Console.ReadKey(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /28_FileIO/ExampleStreamWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | public class ExampleStreamWriter 7 | { 8 | public void Run() 9 | { 10 | string[] names = new string[] { "Zara Ali", "Nuha Ali" }; 11 | using (StreamWriter sw = new StreamWriter("names.txt")) 12 | { 13 | foreach (string s in names) 14 | { 15 | sw.WriteLine(s); 16 | } 17 | } 18 | 19 | // Read and show each line from the file. 20 | string line = ""; 21 | using (StreamReader sr = new StreamReader("names.txt")) 22 | { 23 | while ((line = sr.ReadLine()) != null) 24 | { 25 | Console.WriteLine(line); 26 | } 27 | } 28 | Console.ReadKey(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /28_FileIO/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace FileIO 5 | { 6 | class Program 7 | { 8 | static void Main(string[] args) 9 | { 10 | //ExampleFileStream exampleFileStream = new ExampleFileStream(); 11 | //exampleFileStream.Run(); 12 | 13 | //ExampleStreamReader exampleStreamReader = new ExampleStreamReader(); 14 | //exampleStreamReader.Run(); 15 | 16 | //ExampleStreamWriter exampleStreamWriter = new ExampleStreamWriter(); 17 | //exampleStreamWriter.Run(); 18 | 19 | //ExampleBinary exampleBinary = new ExampleBinary(); 20 | //exampleBinary.Run(); 21 | 22 | ExampleDirectory exampleDirectory = new ExampleDirectory(); 23 | exampleDirectory.Run(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /28_FileIO/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FileIO")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FileIO")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("9fa8810b-1be3-4784-819f-4cb5e8e165ce")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /28_FileIO/jamaica.txt: -------------------------------------------------------------------------------- 1 | Down the way where the nights are gay 2 | And the sun shines daily on the mountain top 3 | I took a trip on a sailing ship 4 | And when I reached Jamaica 5 | I made a stop -------------------------------------------------------------------------------- /33_Delegates/33_Delegates.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6} 8 | Exe 9 | _33_Delegates 10 | 33_Delegates 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /33_Delegates/33_Delegates.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "33_Delegates", "33_Delegates.csproj", "{8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8DF0F95D-56B7-4EE2-9F37-D3ADBB5442A6}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {5423DF71-2CDF-4AA2-919A-3521DC8B2807} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /33_Delegates/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /33_Delegates/ExampleDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _33_Delegates 8 | { 9 | public class ExampleDelegate 10 | { 11 | delegate int NumberChanger(int n); 12 | 13 | public void Run() 14 | { 15 | //create delegate instances 16 | NumberChanger nc1 = new NumberChanger(AddNum); 17 | NumberChanger nc2 = new NumberChanger(MultNum); 18 | //calling the methods using the delegate objects 19 | nc1(25); 20 | Console.WriteLine("Value of Num: {0}", getNum()); 21 | nc2(5); 22 | Console.WriteLine("Value of Num: {0}", getNum()); 23 | Console.ReadKey(); 24 | } 25 | 26 | static int num = 10; 27 | public static int AddNum(int p) 28 | { 29 | num += p; 30 | return num; 31 | } 32 | public static int MultNum(int q) 33 | { 34 | num *= q; 35 | return num; 36 | } 37 | public static int getNum() 38 | { 39 | return num; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /33_Delegates/ExampleDelegateUsage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace _33_Delegates 9 | { 10 | public class ExampleDelegateUsage 11 | { 12 | // delegate declaration 13 | public delegate void printString(string s); 14 | 15 | static FileStream fs; 16 | static StreamWriter sw; 17 | 18 | 19 | // this method prints to the console 20 | public static void WriteToScreen(string str) 21 | { 22 | Console.WriteLine("The String is: {0}", str); 23 | } 24 | 25 | //this method prints to a file 26 | public static void WriteToFile(string s) 27 | { 28 | fs = new FileStream("message.txt", FileMode.Append, FileAccess.Write); 29 | sw = new StreamWriter(fs); 30 | sw.WriteLine(s); 31 | sw.Flush(); 32 | sw.Close(); 33 | fs.Close(); 34 | } 35 | 36 | // this method takes the delegate as parameter and uses it to 37 | // call the methods as required 38 | public static void sendString(printString ps) 39 | { 40 | ps("Hello World"); 41 | } 42 | 43 | public void Run() 44 | { 45 | printString ps1 = new printString(WriteToScreen); 46 | printString ps2 = new printString(WriteToFile); 47 | sendString(ps1); 48 | sendString(ps2); 49 | Console.ReadKey(); 50 | } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /33_Delegates/ExampleMulticastDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _33_Delegates 8 | { 9 | public class ExampleMulticastDelegate 10 | { 11 | delegate int NumberChanger(int n); 12 | 13 | public void Run() 14 | { 15 | //create delegate instances 16 | NumberChanger nc; 17 | NumberChanger nc1 = new NumberChanger(AddNum); 18 | NumberChanger nc2 = new NumberChanger(MultNum); 19 | nc = nc1; 20 | nc += nc2; 21 | //calling multicast 22 | nc(5); 23 | Console.WriteLine("Value of Num: {0}", getNum()); 24 | Console.ReadKey(); 25 | } 26 | 27 | static int num = 10; 28 | public static int AddNum(int p) 29 | { 30 | num += p; 31 | return num; 32 | } 33 | public static int MultNum(int q) 34 | { 35 | num *= q; 36 | return num; 37 | } 38 | public static int getNum() 39 | { 40 | return num; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /33_Delegates/ExampleTimer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Timers; 3 | 4 | namespace _33_Delegates 5 | { 6 | public class ExampleTimer 7 | { 8 | public void Run() 9 | { 10 | // Create a timer with a two second interval. 11 | Timer timer = new Timer(2000); 12 | // Hook up the Elapsed event for the timer. 13 | timer.Elapsed += OnTimedEvent; 14 | timer.AutoReset = true; 15 | timer.Enabled = true; 16 | Console.ReadKey(); 17 | } 18 | 19 | private static void OnTimedEvent(Object source, ElapsedEventArgs e) 20 | { 21 | Console.WriteLine("The Elapsed event was raised at {0:HH:mm:ss.fff}",e.SignalTime); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /33_Delegates/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _33_Delegates 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | //ExampleDelegate exampleDelegate = new ExampleDelegate(); 14 | //exampleDelegate.Run(); 15 | 16 | //ExampleMulticastDelegate exampleMulticastDelegate = new ExampleMulticastDelegate(); 17 | //exampleMulticastDelegate.Run(); 18 | 19 | //ExampleDelegateUsage exampleDelegateUsage = new ExampleDelegateUsage(); 20 | //exampleDelegateUsage.Run(); 21 | 22 | ExampleTimer exampleTimer = new ExampleTimer(); 23 | exampleTimer.Run(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /33_Delegates/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("33_Delegates")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("33_Delegates")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8df0f95d-56b7-4ee2-9f37-d3adbb5442a6")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /34_Events/34_Events.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8901DAA8-1364-463E-B6E2-80A5C22E2CF0} 8 | Exe 9 | _34_Events 10 | 34_Events 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | Form 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /34_Events/34_Events.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "34_Events", "34_Events.csproj", "{8901DAA8-1364-463E-B6E2-80A5C22E2CF0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8901DAA8-1364-463E-B6E2-80A5C22E2CF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8901DAA8-1364-463E-B6E2-80A5C22E2CF0}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8901DAA8-1364-463E-B6E2-80A5C22E2CF0}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8901DAA8-1364-463E-B6E2-80A5C22E2CF0}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {4F27B01D-7355-4AAD-B90F-9F9B7352A81A} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /34_Events/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /34_Events/ExampleEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _34_Events 8 | { 9 | public delegate void EventHandler(string a); 10 | 11 | public class Operation 12 | { 13 | public event EventHandler handler; 14 | 15 | public void TriggerEvent(string a) 16 | { 17 | if (handler != null) 18 | { 19 | handler(a); 20 | } 21 | else 22 | { 23 | Console.WriteLine("Event Handler Is Not Registered"); 24 | } 25 | } 26 | } 27 | 28 | public class ExampleEvent 29 | { 30 | public static void CatchEvent(string s) 31 | { 32 | Console.WriteLine("Event Caught. Will process accordingly."); 33 | Console.WriteLine(s); 34 | } 35 | 36 | public void Run() 37 | { 38 | Operation o = new Operation(); 39 | o.handler += new EventHandler(CatchEvent); 40 | 41 | // Event Occurred 42 | o.TriggerEvent("A new Message!"); 43 | 44 | Console.ReadLine(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /34_Events/ExampleForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | using System.Windows.Forms; 8 | 9 | namespace _34_Events 10 | { 11 | public partial class ExampleForm : Form 12 | { 13 | public ExampleForm() 14 | { 15 | } 16 | 17 | public void Run() 18 | { 19 | // desing a button over form 20 | Button btn = new Button(); 21 | btn.Parent = this; 22 | btn.Text = "Save"; 23 | btn.Location = new Point(10, 10); 24 | 25 | //Event handler is assigned to the button click event 26 | btn.Click += new System.EventHandler(CatchClickEvent); 27 | 28 | Console.ReadLine(); 29 | 30 | } 31 | 32 | //call when button clicked 33 | public void CatchClickEvent(object sender, EventArgs e) 34 | { 35 | MessageBox.Show("Your admission has been saved!"); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /34_Events/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _34_Events 8 | { 9 | internal class Program 10 | { 11 | [STAThread] 12 | static void Main(string[] args) 13 | { 14 | ExampleEvent exampleEvent = new ExampleEvent(); 15 | exampleEvent.Run(); 16 | 17 | //ExampleForm exampleForm = new ExampleForm(); 18 | //System.Windows.Forms.Application.Run(exampleForm); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /34_Events/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("34_Events")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("34_Events")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8901daa8-1364-463e-b6e2-80a5c22e2cf0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /35_Collections/35_Collections.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31613.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "35_Collections", "35_Collections.csproj", "{79CA4AA1-13D4-41D9-92E1-EBBA04685FF8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {79CA4AA1-13D4-41D9-92E1-EBBA04685FF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {79CA4AA1-13D4-41D9-92E1-EBBA04685FF8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {79CA4AA1-13D4-41D9-92E1-EBBA04685FF8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {79CA4AA1-13D4-41D9-92E1-EBBA04685FF8}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D20D2AC1-C10B-4CE6-8849-94A0E5D0951F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /35_Collections/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /35_Collections/ExampleArrayList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleArrayList 7 | { 8 | public void Run() 9 | { 10 | ArrayList al = new ArrayList(); 11 | Console.WriteLine("Adding some numbers:"); 12 | al.Add(45); 13 | al.Add(78); 14 | al.Add(33); 15 | al.Add(56); 16 | al.Add(12); 17 | al.Add(23); 18 | al.Add(9); 19 | Console.WriteLine("Capacity: {0} ", al.Capacity); 20 | Console.WriteLine("Count: {0}", al.Count); 21 | Console.Write("Content: "); 22 | foreach (int i in al) 23 | { 24 | Console.Write(i + " "); 25 | } 26 | Console.WriteLine(); 27 | Console.Write("Sorted Content: "); 28 | al.Sort(); 29 | foreach (int i in al) 30 | { 31 | Console.Write(i + " "); 32 | } 33 | Console.WriteLine(); 34 | Console.ReadKey(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /35_Collections/ExampleBitArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleBitArray 7 | { 8 | public void Run() 9 | { 10 | //creating two bit arrays of size 8 11 | BitArray ba1 = new BitArray(8); 12 | BitArray ba2 = new BitArray(8); 13 | byte[] a = { 60 }; 14 | byte[] b = { 13 }; 15 | //storing the values 60, and 13 into the bit arrays 16 | ba1 = new BitArray(a); 17 | ba2 = new BitArray(b); 18 | //content of ba1 19 | Console.WriteLine("Bit array ba1: 60"); 20 | for (int i = 0; i < ba1.Count; i++) 21 | { 22 | Console.Write("{0, -6} ", ba1[i]); 23 | } 24 | Console.WriteLine(); 25 | //content of ba2 26 | Console.WriteLine("Bit array ba2: 13"); 27 | for (int i = 0; i < ba2.Count; i++) 28 | { 29 | Console.Write("{0, -6} ", ba2[i]); 30 | } 31 | Console.WriteLine(); 32 | BitArray ba3 = new BitArray(8); 33 | ba3 = ba1.And(ba2); 34 | //content of ba3 35 | Console.WriteLine("Bit array ba3 after AND operation: 12"); 36 | for (int i = 0; i < ba3.Count; i++) 37 | { 38 | Console.Write("{0, -6} ", ba3[i]); 39 | } 40 | Console.WriteLine(); 41 | ba3 = ba1.Or(ba2); 42 | //content of ba3 43 | Console.WriteLine("Bit array ba3 after OR operation: 61"); 44 | for (int i = 0; i < ba3.Count; i++) 45 | { 46 | Console.Write("{0, -6} ", ba3[i]); 47 | } 48 | Console.WriteLine(); 49 | Console.ReadKey(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /35_Collections/ExampleHashtable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleHashtable 7 | { 8 | public void Run() 9 | { 10 | Hashtable ht = new Hashtable(); 11 | ht.Add("001", "Zara Ali"); 12 | ht.Add("002", "Abida Rehman"); 13 | ht.Add("003", "Joe Holzner"); 14 | ht.Add("004", "Mausam Benazir Nur"); 15 | ht.Add("005", "M. Amlan"); 16 | ht.Add("006", "M. Arif"); 17 | ht.Add("007", "Ritesh Saikia"); 18 | if (ht.ContainsValue("Nuha Ali")) 19 | { 20 | Console.WriteLine("This student name is already in the list"); 21 | } 22 | else 23 | { 24 | ht.Add("008", "Nuha Ali"); 25 | } 26 | // Get a collection of the keys. 27 | ICollection key = ht.Keys; 28 | foreach (string k in key) 29 | { 30 | Console.WriteLine(k + ": " + ht[k]); 31 | } 32 | Console.ReadKey(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /35_Collections/ExampleQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleQueue 7 | { 8 | public void Run() 9 | { 10 | Queue q = new Queue(); 11 | q.Enqueue(10); 12 | q.Enqueue(20); 13 | q.Enqueue(30); 14 | q.Enqueue(40); 15 | Console.WriteLine("Current queue: "); 16 | foreach (int c in q) 17 | Console.Write(c + " "); 18 | Console.WriteLine(); 19 | 20 | q.Enqueue(50); 21 | q.Enqueue(60); 22 | Console.WriteLine("Current queue: "); 23 | foreach (int c in q) 24 | Console.Write(c + " "); 25 | 26 | Console.WriteLine(); 27 | Console.WriteLine("Removing some values "); 28 | 29 | int ch = (int)q.Dequeue(); 30 | Console.WriteLine("The removed value: {0}", ch); 31 | 32 | ch = (int)q.Dequeue(); 33 | Console.WriteLine("The removed value: {0}", ch); 34 | 35 | Console.ReadKey(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /35_Collections/ExampleSortedList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleSortedList 7 | { 8 | public void Run() 9 | { 10 | SortedList sl = new SortedList(); 11 | sl.Add("001", "Zara Ali"); 12 | sl.Add("002", "Abida Rehman"); 13 | sl.Add("003", "Joe Holzner"); 14 | sl.Add("004", "Mausam Benazir Nur"); 15 | sl.Add("005", "M. Amlan"); 16 | sl.Add("006", "M. Arif"); 17 | sl.Add("007", "Ritesh Saikia"); 18 | if (sl.ContainsValue("Nuha Ali")) 19 | { 20 | Console.WriteLine("This student name is already in the list"); 21 | } 22 | else 23 | { 24 | sl.Add("008", "Nuha Ali"); 25 | } 26 | // get a collection of the keys. 27 | ICollection key = sl.Keys; 28 | foreach (string k in key) 29 | { 30 | Console.WriteLine(k + ": " + sl[k]); 31 | } 32 | 33 | Console.ReadKey(); 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /35_Collections/ExampleStack.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | 4 | namespace _35_Collections 5 | { 6 | public class ExampleStack 7 | { 8 | public void Run() 9 | { 10 | Stack st = new Stack(); 11 | st.Push('A'); 12 | st.Push('B'); 13 | st.Push('C'); 14 | 15 | Console.WriteLine("Current stack: "); 16 | foreach (char c in st) 17 | { 18 | Console.Write(c + " "); 19 | } 20 | Console.WriteLine(); 21 | 22 | st.Push('D'); 23 | st.Push('E'); 24 | 25 | Console.WriteLine("The next poppable value in stack: {0}",st.Peek()); 26 | 27 | Console.WriteLine("Current stack: "); 28 | foreach (char c in st) 29 | { 30 | Console.Write(c + " "); 31 | } 32 | 33 | Console.WriteLine(); 34 | Console.WriteLine("Removing values "); 35 | 36 | st.Pop(); 37 | st.Pop(); 38 | st.Pop(); 39 | 40 | Console.WriteLine("Current stack: "); 41 | foreach (char c in st) 42 | { 43 | Console.Write(c + " "); 44 | } 45 | Console.ReadKey(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /35_Collections/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _35_Collections 8 | { 9 | class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | ExampleArrayList exampleArrayList = new ExampleArrayList(); 14 | exampleArrayList.Run(); 15 | 16 | //ExampleHashtable exampleHashtable = new ExampleHashtable(); 17 | //exampleHashtable.Run(); 18 | 19 | //ExampleSortedList exampleSortedList = new ExampleSortedList(); 20 | //exampleSortedList.Run(); 21 | 22 | //ExampleStack exampleStack = new ExampleStack(); 23 | //exampleStack.Run(); 24 | 25 | //ExampleQueue exampleQueue = new ExampleQueue(); 26 | //exampleQueue.Run(); 27 | 28 | //ExampleBitArray exampleBitArray = new ExampleBitArray(); 29 | //exampleBitArray.Run(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /35_Collections/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("35_Collections")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("35_Collections")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("79ca4aa1-13d4-41d9-92e1-ebba04685ff8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /36_Generics/36_Generics.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B7F508DD-A1A1-4EFF-80B2-723627DB58F2} 8 | Exe 9 | _36_Generics 10 | 36_Generics 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /36_Generics/36_Generics.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "36_Generics", "36_Generics.csproj", "{B7F508DD-A1A1-4EFF-80B2-723627DB58F2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {B7F508DD-A1A1-4EFF-80B2-723627DB58F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {B7F508DD-A1A1-4EFF-80B2-723627DB58F2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {B7F508DD-A1A1-4EFF-80B2-723627DB58F2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {B7F508DD-A1A1-4EFF-80B2-723627DB58F2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {432C61B2-B4FA-4BA3-9269-62140DA3006B} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /36_Generics/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /36_Generics/ExampleGenericArray.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace _36_Generics 4 | { 5 | public class ExampleGenericArray 6 | { 7 | public void Run() 8 | { 9 | /* declaring an int array */ 10 | GenericArray intArray = new GenericArray(5); 11 | 12 | //setting values 13 | for (int c = 0; c < 5; c++) 14 | { 15 | intArray.setItem(c, c * 5); 16 | } 17 | 18 | //retrieving the values 19 | for (int c = 0; c < 5; c++) 20 | { 21 | Console.Write(intArray.getItem(c) + " "); 22 | } 23 | Console.WriteLine(); 24 | 25 | 26 | /* declaring an character array */ 27 | GenericArray charArray = new GenericArray(5); 28 | //setting values 29 | for (int c = 0; c < 5; c++) 30 | { 31 | charArray.setItem(c, (char)(c + 97)); 32 | } 33 | 34 | //retrieving the values 35 | for (int c = 0; c < 5; c++) 36 | { 37 | Console.Write(charArray.getItem(c) + " "); 38 | } 39 | 40 | Console.WriteLine(); 41 | Console.ReadKey(); 42 | 43 | } 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /36_Generics/ExampleGenericFunction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace _36_Generics 4 | { 5 | public class ExampleGenericFunction 6 | { 7 | private void Swap(ref T lhs, ref T rhs) 8 | { 9 | T temp; 10 | temp = lhs; 11 | lhs = rhs; 12 | rhs = temp; 13 | } 14 | 15 | public void Run() 16 | { 17 | int a = 10, b = 20; 18 | char c = 'I', d = 'V'; 19 | 20 | //Display values Before Swap: 21 | Console.WriteLine("Int values before calling swap:"); 22 | Console.WriteLine("a = {0}, b = {1}", a, b); 23 | //Call swap 24 | Swap(ref a, ref b); 25 | //Display values after swap: 26 | Console.WriteLine("\nInt values after calling swap:"); 27 | Console.WriteLine("a = {0}, b = {1}", a, b); 28 | 29 | //Display values Before Swap: 30 | Console.WriteLine("\n\nChar values before calling swap:"); 31 | Console.WriteLine("c = {0}, d = {1}", c, d); 32 | //Call swap 33 | Swap(ref c, ref d); 34 | //Display values after swap: 35 | Console.WriteLine("\nChar values after calling swap:"); 36 | Console.WriteLine("c = {0}, d = {1}", c, d); 37 | Console.ReadKey(); 38 | 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /36_Generics/GenericArray.cs: -------------------------------------------------------------------------------- 1 | namespace _36_Generics 2 | { 3 | public class GenericArray 4 | { 5 | private T[] array; 6 | 7 | public GenericArray(int size) 8 | { 9 | array = new T[size + 1]; 10 | } 11 | 12 | public T getItem(int index) 13 | { 14 | return array[index]; 15 | } 16 | 17 | public void setItem(int index, T value) 18 | { 19 | array[index] = value; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /36_Generics/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _36_Generics 8 | { 9 | public class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | //ExampleGenericArray exampleGenericArray = new ExampleGenericArray(); 14 | //exampleGenericArray.Run(); 15 | 16 | ExampleGenericFunction exampleGenericFunction = new ExampleGenericFunction(); 17 | exampleGenericFunction.Run(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /36_Generics/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("36_Generics")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("36_Generics")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b7f508dd-a1a1-4eff-80b2-723627db58f2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /39_Multithreading/39_Multithreading.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A5A23FF8-85DD-403E-9040-B44F635CB253} 8 | Exe 9 | _39_Multithreading 10 | 39_Multithreading 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /39_Multithreading/39_Multithreading.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "39_Multithreading", "39_Multithreading.csproj", "{A5A23FF8-85DD-403E-9040-B44F635CB253}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {A5A23FF8-85DD-403E-9040-B44F635CB253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {A5A23FF8-85DD-403E-9040-B44F635CB253}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {A5A23FF8-85DD-403E-9040-B44F635CB253}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {A5A23FF8-85DD-403E-9040-B44F635CB253}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {C681C8B5-8DE3-41DA-A060-F60339175067} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /39_Multithreading/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /39_Multithreading/ExampleCreate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace _39_Multithreading 5 | { 6 | public class ExampleCreate 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("In Main Thread: Creating the Child thread\n\n"); 11 | 12 | ThreadStart threadStart = new ThreadStart(ThreadFunction); 13 | Thread thread = new Thread(threadStart); 14 | thread.Name = "Thread # 1"; 15 | thread.Start(); 16 | 17 | Console.ReadKey(); 18 | } 19 | 20 | // This function will run on separate thread 21 | public void ThreadFunction() 22 | { 23 | Console.WriteLine("I am running on Child Thread"); 24 | 25 | Console.WriteLine("My name is " + Thread.CurrentThread.Name); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /39_Multithreading/ExampleCreateMultiple.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace _39_Multithreading 5 | { 6 | public class ExampleCreateMultiple 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("In Main Thread: Creating the Child thread\n\n"); 11 | 12 | ThreadStart threadStart = new ThreadStart(ThreadFunction); 13 | 14 | for(int i = 0; i < 10; i++) 15 | { 16 | Thread thread = new Thread(threadStart); 17 | thread.Name = "Thread # : " + i; 18 | thread.Start(); 19 | 20 | Thread.Sleep(5 * 1000); 21 | } 22 | 23 | Console.ReadKey(); 24 | } 25 | 26 | // This function will run on separate thread 27 | public void ThreadFunction() 28 | { 29 | Console.WriteLine("I am running on Child Thread"); 30 | Console.WriteLine("My name is " + Thread.CurrentThread.Name); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /39_Multithreading/ExampleDestroy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace _39_Multithreading 5 | { 6 | public class ExampleDestroy 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("In Main Thread: Creating the Child thread\n\n"); 11 | 12 | ThreadStart threadStart = new ThreadStart(ThreadFunction); 13 | Thread thread = new Thread(threadStart); 14 | thread.Start(); 15 | 16 | //stop the main thread for some time 17 | Thread.Sleep(3000); 18 | 19 | // Now abort the child 20 | Console.WriteLine(Environment.NewLine); 21 | Console.WriteLine("In Main Thread: Aborting the Child thread"); 22 | thread.Abort(); 23 | 24 | Console.ReadKey(); 25 | } 26 | 27 | // This function will run on separate thread 28 | public static void ThreadFunction() 29 | { 30 | Console.WriteLine("I am running on Child Thread"); 31 | Console.WriteLine("I am Counting from 101 to 110 but with Pause for 1 second (1000 miliseconds)"); 32 | 33 | try 34 | { 35 | for (int i = 101; i <= 110; i++) 36 | { 37 | Console.WriteLine("Pause for 1 sec"); 38 | Thread.Sleep(1000); 39 | Console.WriteLine(i); 40 | } 41 | } 42 | catch (ThreadAbortException ex) 43 | { 44 | Console.WriteLine("Thread Abort Exception; Main Thread aborted Child Thread."); 45 | } 46 | finally 47 | { 48 | Console.WriteLine("Counting Done."); 49 | } 50 | 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /39_Multithreading/ExampleMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace _39_Multithreading 5 | { 6 | public class ExampleMain 7 | { 8 | public void Run() 9 | { 10 | Thread th = Thread.CurrentThread; 11 | th.Name = "MainThread"; 12 | Console.WriteLine("I am {0}", th.Name); 13 | Console.ReadKey(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /39_Multithreading/ExampleManage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | 4 | namespace _39_Multithreading 5 | { 6 | public class ExampleManage 7 | { 8 | public void Run() 9 | { 10 | Console.WriteLine("In Main Thread: Creating the Child thread\n\n"); 11 | 12 | ThreadStart threadStart = new ThreadStart(ThreadFunction); 13 | Thread thread = new Thread(threadStart); 14 | thread.Name = "Thread # 1"; 15 | thread.Start(); 16 | 17 | Console.ReadKey(); 18 | } 19 | 20 | // This function will run on separate thread 21 | public static void ThreadFunction() 22 | { 23 | Console.WriteLine("I am running on Child Thread"); 24 | Console.WriteLine("I am going to Pause for 10 seconds (10*1000 miliseconds), then I will show you my Name"); 25 | 26 | Thread.Sleep(10 * 1000); 27 | 28 | Console.WriteLine("My name is " + Thread.CurrentThread.Name); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /39_Multithreading/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace _39_Multithreading 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | //ExampleMain exampleMain = new ExampleMain(); 14 | //exampleMain.Run(); 15 | 16 | //ExampleCreate exampleCreate = new ExampleCreate(); 17 | //exampleCreate.Run(); 18 | 19 | //ExampleCreateMultiple multiple = new ExampleCreateMultiple(); 20 | //multiple.Run(); 21 | 22 | //ExampleManage exampleManage = new ExampleManage(); 23 | //exampleManage.Run(); 24 | 25 | ExampleDestroy exampleDestroy = new ExampleDestroy(); 26 | exampleDestroy.Run(); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /39_Multithreading/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("39_Multithreading")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("39_Multithreading")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a5a23ff8-85dd-403e-9040-b44f635cb253")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /BzuShopDatabase/BzuShopERD.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/BzuShopDatabase/BzuShopERD.PNG -------------------------------------------------------------------------------- /BzuShopDatabase/db_create_tables.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE Bills 2 | DROP TABLE OrderProducts 3 | DROP TABLE Orders 4 | DROP TABLE Products 5 | DROP TABLE Customers 6 | 7 | CREATE TABLE Customers ( 8 | [ID] [int] NOT NULL, 9 | [Name] [varchar](255) NULL, 10 | [Phone] [nchar](10) NULL, 11 | [Address] [varchar](max) NULL, 12 | [Gender] [int] NULL, 13 | PRIMARY KEY (ID), 14 | ); 15 | 16 | CREATE TABLE Products ( 17 | [ID] [int] NOT NULL, 18 | [Name] [nchar](100) NULL, 19 | [UnitPrice] [decimal](18, 0) NULL, 20 | [StockQuantity] [int] NULL, 21 | PRIMARY KEY (ID), 22 | ); 23 | 24 | CREATE TABLE Orders ( 25 | ID int NOT NULL, 26 | CustomerID INT, 27 | OrderTime DATETIME, 28 | IsConfirmed INT 29 | PRIMARY KEY (ID), 30 | FOREIGN KEY (CustomerID) REFERENCES Customers(ID) 31 | ); 32 | 33 | 34 | CREATE TABLE OrderProducts ( 35 | ID int NOT NULL, 36 | OrderID int NOT NULL, 37 | ProductID INT NOT NULL, 38 | QuantityOrdered INT 39 | PRIMARY KEY (ID), 40 | FOREIGN KEY (OrderID) REFERENCES Orders(ID), 41 | FOREIGN KEY (ProductID) REFERENCES Products(ID), 42 | ); 43 | 44 | 45 | CREATE TABLE Bills ( 46 | ID int NOT NULL, 47 | OrderID int NOT NULL, 48 | Amount INT NOT NULL, 49 | BillTime DATETIME, 50 | IsPaid INT 51 | PRIMARY KEY (ID), 52 | FOREIGN KEY (OrderID) REFERENCES Orders(ID), 53 | ); 54 | 55 | -------------------------------------------------------------------------------- /BzuShopDatabase/db_insert_data.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM Bills 2 | DELETE FROM OrderProducts 3 | DELETE FROM Orders 4 | DELETE FROM Customers 5 | DELETE FROM Products 6 | 7 | -------------------------------- 8 | INSERT INTO Products(ID, Name, UnitPrice, StockQuantity) 9 | VALUES(1, 'Sugar', 200, 20) 10 | 11 | INSERT INTO Products(ID, Name, UnitPrice, StockQuantity) 12 | VALUES(2, 'Rice', 300, 10) 13 | 14 | INSERT INTO Products(ID, Name, UnitPrice, StockQuantity) 15 | VALUES(3, 'Biskat', 20, 100) 16 | 17 | SELECT * FROM Products 18 | 19 | -------------------------------- 20 | INSERT INTO Customers(ID, Name, Phone, Address, Gender) 21 | VALUES(1, 'Kamran Qadir', '0321', 'BZU Lodhran', 1) 22 | 23 | SELECT * FROM Customers 24 | 25 | -------------------------------- 26 | INSERT INTO Orders(ID, CustomerID, OrderTime, IsConfirmed) 27 | VALUES(1, 1, CURRENT_TIMESTAMP, 1) 28 | 29 | SELECT * FROM Orders 30 | 31 | -------------------------------- 32 | DELETE FROM OrderProducts 33 | 34 | INSERT INTO OrderProducts(ID, OrderID, ProductID, QuantityOrdered) 35 | VALUES(1, 1, 1, 2) 36 | 37 | INSERT INTO OrderProducts(ID, OrderID, ProductID, QuantityOrdered) 38 | VALUES(2, 1, 2, 3) 39 | 40 | INSERT INTO OrderProducts(ID, OrderID, ProductID, QuantityOrdered) 41 | VALUES(3, 1, 3, 1) 42 | 43 | SELECT * FROM OrderProducts 44 | 45 | -------------------------------- 46 | DELETE FROM Bills 47 | 48 | INSERT INTO Bills(ID, OrderID, Amount, BillTime, IsPaid) 49 | VALUES(1, 1, 200, CURRENT_TIMESTAMP, 0) 50 | 51 | SELECT * FROM Bills 52 | -------------------------------------------------------------------------------- /BzuShopDatabase/db_select_data.sql: -------------------------------------------------------------------------------- 1 | -- 1. Today's All Confirmed Orders 2 | SELECT o.* FROM 3 | Orders o 4 | WHERE 5 | CAST(o.OrderTime AS DATE) = '2023-11-23' 6 | AND o.IsConfirmed = 1 7 | 8 | -- 2. Customer Name with Bill Amount of Today's orders 9 | SELECT c.Name, b.Amount FROM 10 | Orders o, Customers c, Bills b 11 | WHERE o.CustomerID = c.ID 12 | AND o.ID = b.OrderID 13 | AND CAST(o.OrderTime AS DATE) = '2023-11-23' 14 | 15 | -- 3. Customer Name whose bills are not paid with bill amount 16 | SELECT c.Name, b.Amount FROM 17 | Orders o, Customers c, Bills b 18 | WHERE o.CustomerID = c.ID 19 | AND o.ID = b.OrderID 20 | AND b.IsPaid = 0 21 | 22 | -- 4. Which products sold today with quantity sold 23 | SELECT p.Name, op.QuantityOrdered FROM 24 | Orders o, OrderProducts op, Products p 25 | WHERE o.ID = op.OrderID 26 | AND op.ProductID = p.ID 27 | AND CAST(o.OrderTime AS DATE) = '2023-11-23' -------------------------------------------------------------------------------- /C# Tutorial (PDF Version) - Tutorials Point.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/C# Tutorial (PDF Version) - Tutorials Point.pdf -------------------------------------------------------------------------------- /ConsoleAppFirst/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ConsoleAppFirst.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleAppFirst", "ConsoleAppFirst.csproj", "{117F2C08-8058-4569-86F9-DE680C3781BD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {117F2C08-8058-4569-86F9-DE680C3781BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {117F2C08-8058-4569-86F9-DE680C3781BD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {117F2C08-8058-4569-86F9-DE680C3781BD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {117F2C08-8058-4569-86F9-DE680C3781BD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {196D3D4A-F4A3-4590-998F-5308449C7251} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ExampleClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class ExampleClass 10 | { 11 | public void Run() 12 | { 13 | Rectangle r = new Rectangle(); 14 | r.Acceptdetails(); 15 | r.Display(); 16 | Console.ReadLine(); 17 | } 18 | } 19 | 20 | class Rectangle 21 | { 22 | // member variables 23 | double length; 24 | double width; 25 | public void Acceptdetails() 26 | { 27 | length = 4.5; 28 | width = 3.5; 29 | } 30 | 31 | public double GetArea() 32 | { 33 | return length * width; 34 | } 35 | 36 | public void Display() 37 | { 38 | Console.WriteLine("Length: {0}", length); 39 | Console.WriteLine("Width: {0}", width); 40 | Console.WriteLine("Area: {0}", GetArea()); 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ExampleEnum.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class ExampleEnum 10 | { 11 | enum Days { Sun, Mon, tue, Wed, thu, Fri, Sat }; 12 | 13 | public void Run() 14 | { 15 | int WeekdayStart = (int)Days.Mon; 16 | int WeekdayEnd = (int)Days.Fri; 17 | Console.WriteLine("Monday: {0}", WeekdayStart); 18 | Console.WriteLine("Friday: {0}", WeekdayEnd); 19 | 20 | // Real-world Example 21 | var dt = DateTime.Now; 22 | if((int)dt.DayOfWeek == (int)Days.thu) 23 | Console.WriteLine("Today is Programming class " + dt.ToString()); 24 | 25 | Console.ReadKey(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ExampleExceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class ExampleExceptions 10 | { 11 | public void Run() 12 | { 13 | try 14 | { 15 | int a = 1; 16 | int b = 0; 17 | int result = a/b; 18 | } 19 | catch (Exception ex) 20 | { 21 | Console.WriteLine("An Error has been occured."); 22 | Console.WriteLine(ex.ToString()); 23 | throw ex; 24 | } 25 | finally 26 | { 27 | Console.ReadLine(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ExampleNullable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class ExampleNullable 10 | { 11 | public void Run() 12 | { 13 | int? num1 = null; 14 | int? num2 = 45; 15 | double? num3 = new double?(); 16 | double? num4 = 3.14157; 17 | bool? boolval = new bool?(); 18 | 19 | // display the values 20 | Console.WriteLine("Nullables at Show: {0}, {1}, {2}, {3}", num1, num2, num3, num4); 21 | 22 | Console.WriteLine("A Nullable boolean value: {0}", boolval); 23 | 24 | Console.ReadLine(); 25 | } 26 | 27 | public void Run2() 28 | { 29 | double? num1 = null; 30 | double? num2 = 3.14157; 31 | double num3; 32 | 33 | num3 = num1 ?? 5.34; 34 | Console.WriteLine(" Value of num3: {0}", num3); 35 | 36 | num3 = num2 ?? 5.34; 37 | Console.WriteLine(" Value of num3: {0}", num3); 38 | 39 | Console.ReadLine(); 40 | } 41 | 42 | /// 43 | /// Real-world example 44 | /// 45 | public void CalculateResult() 46 | { 47 | int? marks = null; 48 | if (marks == null) 49 | { 50 | marks = int.Parse(Console.ReadLine()); 51 | } 52 | Console.WriteLine(marks ?? 50); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ConsoleAppFirst/ExampleTypeConversion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class ExampleTypeConversion 10 | { 11 | public void Run() 12 | { 13 | Console.WriteLine("Calling DoubleToInt"); 14 | DoubleToInt(); 15 | 16 | Console.WriteLine("Calling VariableToString"); 17 | VariableToString(); 18 | 19 | Console.ReadKey(); 20 | 21 | } 22 | 23 | public void DoubleToInt() 24 | { 25 | double d = 5673.74; 26 | int i; 27 | // cast double to int. 28 | i = (int)d; 29 | Console.WriteLine(i); 30 | } 31 | 32 | public void VariableToString() 33 | { 34 | int i = 75; 35 | float f = 53.005f; 36 | double d = 2345.7652; 37 | bool b = true; 38 | Console.WriteLine(i.ToString()); 39 | Console.WriteLine(f.ToString()); 40 | Console.WriteLine(d.ToString()); 41 | Console.WriteLine(b.ToString()); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ConsoleAppFirst/InvalidPinException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | public class InvalidPinException : Exception 10 | { 11 | public InvalidPinException() { } 12 | public InvalidPinException(string message) : base(message) { } 13 | public InvalidPinException(string message, Exception inner) : base(message, inner) { } 14 | protected InvalidPinException( 15 | System.Runtime.Serialization.SerializationInfo info, 16 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ConsoleAppFirst/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleAppFirst 8 | { 9 | internal class Program 10 | { 11 | static void Main(string[] args) 12 | { 13 | /* my first program in C# */ 14 | //Console.WriteLine("Welcome to C#"); 15 | //Console.ReadKey(); 16 | 17 | //ExampleClass obj1 = new ExampleClass(); 18 | //obj1.Run(); 19 | 20 | //ExampleTypeConversion obj2 = new ExampleTypeConversion(); 21 | //obj2.Run(); 22 | 23 | //ExampleNullable obj3 = new ExampleNullable(); 24 | //obj3.Run(); 25 | //obj3.Run2(); 26 | 27 | //ExampleEnum example = new ExampleEnum(); 28 | //example.Run(); 29 | 30 | //ExampleExceptions exampleExceptions = new ExampleExceptions(); 31 | //exampleExceptions.Run(); 32 | 33 | //// Custom Exceptions 34 | //string cardnumber = "12345678"; 35 | //int pin = 1111; 36 | //if (cardnumber != "12345678" && pin != 1111) 37 | // throw new InvalidPinException(); 38 | 39 | Console.ReadLine(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ConsoleAppFirst/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ConsoleAppFirst")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ConsoleAppFirst")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("117f2c08-8058-4569-86f9-de680c3781bd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Inheritance.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/Inheritance.pdf -------------------------------------------------------------------------------- /Inheritance/Inheritance.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32526.322 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Inheritance", "Inheritance\Inheritance.csproj", "{8B5F6E87-A5F0-49E9-8155-4372D9D4727D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8B5F6E87-A5F0-49E9-8155-4372D9D4727D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {8B5F6E87-A5F0-49E9-8155-4372D9D4727D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {8B5F6E87-A5F0-49E9-8155-4372D9D4727D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {8B5F6E87-A5F0-49E9-8155-4372D9D4727D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {0B03101A-3BC0-4C19-BF1B-C9799CA391EF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance 4 | { 5 | internal class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | //With.Example withExample = new With.Example(); 10 | //withExample.Run(); 11 | 12 | WithConstructor.Example withContructorExample = new WithConstructor.Example(); 13 | withContructorExample.Run(); 14 | 15 | Console.ReadKey(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("20220612_Inheritance")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("20220612_Inheritance")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8b5f6e87-a5f0-49e9-8155-4372d9d4727d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/With/Example.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance.With 4 | { 5 | public class Example 6 | { 7 | public void Run() 8 | { 9 | Console.WriteLine("========================================="); 10 | Console.WriteLine("=======Inheritance Function Call========="); 11 | Console.WriteLine("========================================="); 12 | // Creating Parent class object and saving in Parent type variable 13 | Person person = new Person(); 14 | // It will call Parent class Show 15 | person.Show(); 16 | 17 | Console.WriteLine("========================================="); 18 | // Creating Child class object 19 | Student student = new Student(); 20 | // It will call Child class Student Show 21 | student.Show(); 22 | 23 | Console.WriteLine("========================================="); 24 | // Creating Child class object 25 | Teacher teacher = new Teacher(); 26 | // It will call Child class Teacher Show 27 | teacher.Show(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/With/WithInheritance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance.With 4 | { 5 | public class Person 6 | { 7 | public String CNIC { get; set; } 8 | public String Name { get; set; } 9 | 10 | public void Show() 11 | { 12 | Console.WriteLine("CNIC: \t" + CNIC); 13 | Console.WriteLine("Name: \t" + Name); 14 | } 15 | } 16 | 17 | public class Student : Person 18 | { 19 | public int RollNumber { get; set; } 20 | public int Marks { get; set; } 21 | 22 | public void Show() 23 | { 24 | base.Show(); 25 | Console.WriteLine("Roll Number: \t" + RollNumber); 26 | Console.WriteLine("Marks: \t\t" + Marks); 27 | } 28 | } 29 | 30 | public class Teacher : Person 31 | { 32 | public int EmployeeCode { get; set; } 33 | public String Subject { get; set; } 34 | 35 | public void Show() 36 | { 37 | base.Show(); 38 | Console.WriteLine("Employee Code: \t" + EmployeeCode); 39 | Console.WriteLine("Subject: \t" + Subject); 40 | } 41 | 42 | } 43 | 44 | public class Clerk : Person 45 | { 46 | public String Duty { get; set; } 47 | 48 | public void Show() 49 | { 50 | base.Show(); 51 | Console.WriteLine("Duty: \t" + Duty); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/WithConstructor/Example.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance.WithConstructor 4 | { 5 | public class Example 6 | { 7 | public void Run() 8 | { 9 | Console.WriteLine("========================================="); 10 | Console.WriteLine("=====Inheritance Constructor Call========"); 11 | Console.WriteLine("========================================="); 12 | 13 | Person person = new Person("CNIC-123", "Person Name"); 14 | person.Show(); 15 | 16 | Student student = new Student("CNIC-123", "Student123", 123, 500); 17 | Console.WriteLine("Student Data"); 18 | student.Show(); 19 | 20 | Console.WriteLine("========================================="); 21 | Teacher teacher = new Teacher("CNIC-321", "Teacher321", 321, "Coding"); 22 | Console.WriteLine("Teacher Data"); 23 | teacher.Show(); 24 | 25 | /* 26 | * Polymorphism: 27 | * We can create Child class object and save it in Person type 28 | * - set Parent class show function as *virtual* 29 | * - change Child class show function as *override* 30 | */ 31 | //Person p1 = new Student("CNIC-123", "Student123", 123, 500); 32 | //p1.Show(); 33 | 34 | //Person p2 = new Teacher("CNIC-321", "Teacher321", 321, "Coding"); 35 | //p2.Show(); 36 | 37 | // Inheritance MAGIC is this 38 | //Process(p1); 39 | //Process(p2); 40 | } 41 | 42 | //public void Process(Person person) 43 | //{ 44 | // // Logic 45 | // person.Show(); 46 | //} 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/WithConstructor/WithConstructor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance.WithConstructor 4 | { 5 | public class Person 6 | { 7 | public String CNIC { get; set; } 8 | public String Name { get; set; } 9 | 10 | public Person(string cNIC, string name) 11 | { 12 | CNIC = cNIC; 13 | Name = name; 14 | } 15 | 16 | public void Show() 17 | { 18 | Console.WriteLine("CNIC: \t\t" + CNIC); 19 | Console.WriteLine("Name: \t\t" + Name); 20 | } 21 | } 22 | 23 | public class Student : Person 24 | { 25 | public int RollNumber { get; set; } 26 | public int Marks { get; set; } 27 | 28 | public Student(string cNIC, string name, int rollNumber, int marks) : base(cNIC, name) 29 | { 30 | RollNumber = rollNumber; 31 | Marks = marks; 32 | } 33 | 34 | public void Show() 35 | { 36 | base.Show(); 37 | Console.WriteLine("Roll Number: \t" + RollNumber); 38 | Console.WriteLine("Marks: \t\t" + Marks); 39 | } 40 | } 41 | 42 | public class Teacher : Person 43 | { 44 | public int EmployeeCode { get; set; } 45 | public String Subject { get; set; } 46 | 47 | public Teacher(string cNIC, string name, int employeeCode, string subject) : base(cNIC, name) 48 | { 49 | EmployeeCode = employeeCode; 50 | Subject = subject; 51 | } 52 | 53 | public void Show() 54 | { 55 | base.Show(); 56 | Console.WriteLine("Employee Code: \t" + EmployeeCode); 57 | Console.WriteLine("Subject: \t" + Subject); 58 | } 59 | 60 | } 61 | 62 | public class Clerk : Person 63 | { 64 | public String Duty { get; set; } 65 | 66 | public Clerk(string cNIC, string name, string duty) : base(cNIC, name) 67 | { 68 | Duty = duty; 69 | } 70 | 71 | public void Show() 72 | { 73 | base.Show(); 74 | Console.WriteLine("Duty: \t" + Duty); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Inheritance/Inheritance/Without/WithoutInheritance.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Inheritance.Without 4 | { 5 | public class Studuent 6 | { 7 | public String CNIC { get; set; } 8 | public String Name { get; set; } 9 | public int RollNumber { get; set; } 10 | public int Marks { get; set; } 11 | 12 | public void Show() 13 | { 14 | Console.WriteLine("CNIC: \t" + CNIC); 15 | Console.WriteLine("Name: \t\t" + Name); 16 | Console.WriteLine("Roll Number: \t\t" + RollNumber); 17 | Console.WriteLine("Marks: \t\t" + Marks); 18 | } 19 | } 20 | 21 | public class Teacher 22 | { 23 | public String CNIC { get; set; } 24 | public String Name { get; set; } 25 | public int EmployeeCode { get; set; } 26 | public String Subject { get; set; } 27 | 28 | public void Show() 29 | { 30 | Console.WriteLine("CNIC: \t" + CNIC); 31 | Console.WriteLine("Name: \t\t" + Name); 32 | Console.WriteLine("Employee Code: \t\t" + EmployeeCode); 33 | Console.WriteLine("Subject: \t\t" + Subject); 34 | } 35 | 36 | } 37 | 38 | public class Clerk 39 | { 40 | public String CNIC { get; set; } 41 | public String Name { get; set; } 42 | public String Duty { get; set; } 43 | 44 | public void Show() 45 | { 46 | Console.WriteLine("CNIC: \t" + CNIC); 47 | Console.WriteLine("Name: \t\t" + Name); 48 | Console.WriteLine("Duty: \t\t" + Duty); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Interfaces.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/Interfaces.pdf -------------------------------------------------------------------------------- /Interfaces/Interfaces.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.2.32630.192 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Interfaces", "Interfaces\Interfaces.csproj", "{6554DA66-DD98-404D-B265-665F2FFE8B42}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {6554DA66-DD98-404D-B265-665F2FFE8B42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {6554DA66-DD98-404D-B265-665F2FFE8B42}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {6554DA66-DD98-404D-B265-665F2FFE8B42}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {6554DA66-DD98-404D-B265-665F2FFE8B42}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {20F47F46-E94C-483B-98EC-CD41D33A1F84} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/Example.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Interfaces 4 | { 5 | public class Example 6 | { 7 | public void Run() 8 | { 9 | Console.WriteLine("========================================="); 10 | Console.WriteLine("============= Interfaces ================"); 11 | Console.WriteLine("========================================="); 12 | 13 | // TeachingAssistant object can be saved in ITeachingAssistant or TeachingAssistant 14 | ITeachingAssistant person1 = new TeachingAssistant("CNIC-111", "Teaching Assistant 111", "Junior"); 15 | person1.Show(); 16 | 17 | TeachingAssistant person2 = new TeachingAssistant("CNIC-222", "Teaching Assistant 222", "Senior"); 18 | person2.Show(); 19 | 20 | // OR TeachingAssistant object can be saved in 21 | // even generic interface IPerson or parent class Person 22 | IPerson person3 = new TeachingAssistant("CNIC-333", "Teaching Assistant 333", "Junior"); 23 | person3.Show(); 24 | 25 | Person person4 = new TeachingAssistant("CNIC-444", "Teaching Assistant 444", "Senior"); 26 | person4.Show(); 27 | 28 | // Interface MAGIC is HERE 29 | Process(person1); 30 | Process(person3); 31 | } 32 | 33 | // Receive in child interface 34 | void Process(ITeachingAssistant person) 35 | { 36 | } 37 | 38 | // Receive in parent interface 39 | void Process(IPerson person) 40 | { 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/ExampleInterfaces.cs: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | { 3 | public interface IPerson 4 | { 5 | void Register(); 6 | void Show(); 7 | } 8 | 9 | public interface IStudent : IPerson 10 | { 11 | void Studies(); 12 | } 13 | 14 | public interface ITeacher : IPerson 15 | { 16 | void Teaches(); 17 | } 18 | 19 | // Any class that implements this interface must write code for these functions 20 | // Register and Show from IPerson 21 | // Studies from IStudent 22 | // Teaches from ITeacher 23 | // MarksAssignments from this interface 24 | public interface ITeachingAssistant : IStudent, ITeacher 25 | { 26 | void MarksAssignments(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/Interfaces.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6554DA66-DD98-404D-B265-665F2FFE8B42} 8 | Exe 9 | Interfaces 10 | Interfaces 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Interfaces 4 | { 5 | internal class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Example example = new Example(); 10 | example.Run(); 11 | 12 | Console.ReadKey(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Interfaces/Interfaces/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("20220613_Interfaces")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("20220613_Interfaces")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("6554da66-dd98-404d-b265-665f2ffe8b42")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Kamran Qadir 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LINQ.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/LINQ.pdf -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/Database.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OrderApp.Data 8 | { 9 | public sealed class Database 10 | { 11 | public static readonly string ConnectionString = @"Server=QADIR\SQLEXPRESS;Database=OrderApp;Trusted_Connection=True;"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OrderApp.Data 8 | { 9 | public class Item 10 | { 11 | public int Id { get; set; } 12 | public string Name { get; set; } 13 | public int UnitPrice { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/Order.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OrderApp.Data 8 | { 9 | public class Order 10 | { 11 | public int Id { get; set; } 12 | public string CustomerName { get; set; } 13 | public int Bill { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/OrderItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OrderApp.Data 8 | { 9 | public class OrderItem 10 | { 11 | public int OrderId { get; set; } 12 | public int ItemId { get; set; } 13 | public int Quantity { get; set; } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/PDFGenerator.cs: -------------------------------------------------------------------------------- 1 | using iText.Kernel.Pdf; 2 | using iText.Kernel.Pdf.Canvas.Draw; 3 | using iText.Layout; 4 | using iText.Layout.Element; 5 | using iText.Layout.Properties; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Text; 10 | using System.Threading.Tasks; 11 | 12 | namespace OrderApp.Data 13 | { 14 | public class PdfGenerator 15 | { 16 | public void Generate(Order order) 17 | { 18 | string pdfFilePath = System.IO.Path.Combine(Environment.CurrentDirectory, $"{order.Id}.pdf"); 19 | 20 | // Must have write permissions to the path folder 21 | PdfWriter writer = new PdfWriter(pdfFilePath); 22 | PdfDocument pdf = new PdfDocument(writer); 23 | Document document = new Document(pdf); 24 | Paragraph header = new Paragraph("Customer Order") 25 | .SetTextAlignment(TextAlignment.CENTER) 26 | .SetFontSize(20); 27 | document.Add(header); 28 | 29 | // Line separator 30 | LineSeparator ls = new LineSeparator(new SolidLine()); 31 | document.Add(ls); 32 | 33 | // Add paragraph1 34 | Paragraph paragraph1 = new Paragraph("Customer Name : " + order.CustomerName); 35 | document.Add(paragraph1); 36 | 37 | Paragraph paragraph2 = new Paragraph("Total Bill : " + order.Bill); 38 | document.Add(paragraph2); 39 | 40 | document.Close(); 41 | 42 | System.Diagnostics.Process.Start(pdfFilePath); 43 | 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OrderApp.Data")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OrderApp.Data")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d13508ce-a5f5-42ae-b664-5e697f55482f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/db.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE [dbo].[Item]( 2 | [Id] [int] NULL, 3 | [Name] [varchar](100) NULL, 4 | [UnitPrice] [int] NULL 5 | ) ON [PRIMARY] 6 | GO 7 | 8 | CREATE TABLE [dbo].[OrderItem]( 9 | [OrderId] [int] NOT NULL, 10 | [ItemId] [int] NOT NULL, 11 | [Quantity] [int] NULL 12 | ) ON [PRIMARY] 13 | GO 14 | 15 | CREATE TABLE [dbo].[Orderr]( 16 | [Id] [int] NOT NULL, 17 | [CustomerName] [varchar](100) NULL, 18 | [Bill] [int] NULL 19 | ) ON [PRIMARY] 20 | GO 21 | 22 | INSERT [dbo].[Item] ([Id], [Name], [UnitPrice]) VALUES (1, N'Biskut', 20) 23 | GO 24 | INSERT [dbo].[Item] ([Id], [Name], [UnitPrice]) VALUES (2, N'Choklate', 30) 25 | GO 26 | INSERT [dbo].[Item] ([Id], [Name], [UnitPrice]) VALUES (3, N'Toffee', 5) 27 | GO 28 | INSERT [dbo].[Item] ([Id], [Name], [UnitPrice]) VALUES (4, N'Nimko', 20) 29 | GO 30 | INSERT [dbo].[Item] ([Id], [Name], [UnitPrice]) VALUES (5, N'Lays', 50) 31 | GO -------------------------------------------------------------------------------- /OrderApp/OrderApp.Data/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /OrderApp/OrderApp.SetupWix/Resources/BackgroundLogo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/OrderApp/OrderApp.SetupWix/Resources/BackgroundLogo.jpg -------------------------------------------------------------------------------- /OrderApp/OrderApp.SetupWix/Resources/TopBanner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/OrderApp/OrderApp.SetupWix/Resources/TopBanner.jpg -------------------------------------------------------------------------------- /OrderApp/OrderApp.SetupWix/readme.md: -------------------------------------------------------------------------------- 1 | # Create Setup using Wix Toolset 2 | 3 | * [Download Wix Toolset Build Tools](http://wixtoolset.org/releases/v3.11/stable) - Wix Toolset Build Tools v3.11 4 | * [Wix Toolset Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension) - WiX Toolset Visual Studio 2019 Extension 5 | 6 | # Steps 7 | - Order App is build in bin\debug 8 | - Product.wxs contains all setting related to setup 9 | - Select OrderApp.Setup project and build 10 | - Congrats! Your setup is created in OrderApp.Setup\bin\Debug 11 | 12 | | Topic | Links | 13 | | ------ | ------ | 14 | | Introduction | http://wixtoolset.org/documentation/manual/v3/main/ | 15 | | How To Guides | http://wixtoolset.org/documentation/manual/v3/howtos/ | 16 | | Complete Manual | http://wixtoolset.org/documentation/manual/v3/ | 17 | | Tutorials | https://www.firegiant.com/wix/tutorial/ | -------------------------------------------------------------------------------- /OrderApp/OrderApp/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/ItemForm.cs: -------------------------------------------------------------------------------- 1 | using OrderApp.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace OrderApp 13 | { 14 | public partial class ItemForm : Form 15 | { 16 | OrderForm OrderForm; 17 | public ItemForm(OrderForm orderForm) 18 | { 19 | InitializeComponent(); 20 | OrderForm = orderForm; 21 | } 22 | 23 | private void ItemForm_Load(object sender, EventArgs e) 24 | { 25 | OrderManager orderManager = new OrderManager(); 26 | cmbItems.DataSource = orderManager.GetAllItems(); 27 | cmbItems.DisplayMember = "Name"; 28 | cmbItems.ValueMember = "Id"; 29 | } 30 | 31 | private void btnAdd_Click(object sender, EventArgs e) 32 | { 33 | try 34 | { 35 | ValidateInputs(); 36 | 37 | OrderForm.OrderItems.Add(new OrderItem() 38 | { 39 | OrderId = OrderForm.Order.Id, 40 | ItemId = (int)cmbItems.SelectedValue, 41 | Quantity = int.Parse(txtQuantity.Text) 42 | }); 43 | 44 | OrderForm.RefreshGridView(); 45 | 46 | this.Hide(); 47 | } 48 | catch (Exception ex) 49 | { 50 | MessageBox.Show(ex.Message); 51 | } 52 | 53 | } 54 | 55 | private void ValidateInputs() 56 | { 57 | if (string.IsNullOrEmpty(txtQuantity.Text)) 58 | throw new Exception("Please enter quantity"); 59 | 60 | int quantity = int.Parse(txtQuantity.Text); 61 | if (quantity < 1 || quantity > 100) 62 | throw new Exception("Quantity must be between 1 and 100"); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/MainForm.cs: -------------------------------------------------------------------------------- 1 | using OrderApp.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace OrderApp 13 | { 14 | public partial class MainForm : Form 15 | { 16 | OrderManager orderManager; 17 | public MainForm() 18 | { 19 | InitializeComponent(); 20 | orderManager = new OrderManager(); 21 | } 22 | 23 | private void btnNewOrder_Click(object sender, EventArgs e) 24 | { 25 | OrderForm orderForm = new OrderForm(this); 26 | orderForm.ShowDialog(); 27 | } 28 | 29 | private void MainForm_Load(object sender, EventArgs e) 30 | { 31 | RefreshGridView(); 32 | 33 | } 34 | 35 | public void RefreshGridView() 36 | { 37 | BindingSource bSource = new BindingSource(); 38 | bSource.DataSource = orderManager.GetAllOrders(); 39 | dgvOrders.DataSource = bSource; 40 | } 41 | 42 | private void btnDeleteOrder_Click(object sender, EventArgs e) 43 | { 44 | var selectedRows = dgvOrders.SelectedRows; 45 | if (selectedRows == null || selectedRows.Count == 0) 46 | { 47 | MessageBox.Show("Please select a row to DELETE"); 48 | return; 49 | } 50 | 51 | if (selectedRows[0].Cells[0].Value == null) 52 | return; 53 | 54 | int orderId = (int)selectedRows[0].Cells[0].Value; 55 | orderManager.DeleteOrder(orderId); 56 | MessageBox.Show("Order deleted succefully."); 57 | RefreshGridView(); 58 | 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/OrderForm.cs: -------------------------------------------------------------------------------- 1 | using OrderApp.Data; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Data; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using System.Windows.Forms; 11 | 12 | namespace OrderApp 13 | { 14 | public partial class OrderForm : Form 15 | { 16 | MainForm MainForm; 17 | public Order Order; 18 | public List OrderItems; 19 | 20 | public OrderForm(MainForm mainForm) 21 | { 22 | InitializeComponent(); 23 | 24 | MainForm = mainForm; 25 | 26 | Order = new Order(); 27 | Order.Id = new Random().Next(1000); 28 | OrderItems = new List(); 29 | 30 | RefreshGridView(); 31 | } 32 | 33 | public void RefreshGridView() 34 | { 35 | BindingSource bSource = new BindingSource(); 36 | bSource.DataSource = OrderItems; 37 | dgvOrderItems.DataSource = bSource; 38 | dgvOrderItems.Refresh(); 39 | dgvOrderItems.Update(); 40 | } 41 | 42 | private void btnAddItem_Click(object sender, EventArgs e) 43 | { 44 | ItemForm itemForm = new ItemForm(this); 45 | itemForm.ShowDialog(); 46 | } 47 | 48 | private void btnSaveOrder_Click(object sender, EventArgs e) 49 | { 50 | try 51 | { 52 | ValidateInputs(); 53 | 54 | Order.CustomerName = txtCustomerName.Text; 55 | 56 | OrderManager orderManager = new OrderManager(); 57 | orderManager.SaveOrder(Order, OrderItems); 58 | 59 | MainForm.RefreshGridView(); 60 | 61 | MessageBox.Show("Your order has been saved successfully."); 62 | 63 | } 64 | catch (Exception ex) 65 | { 66 | MessageBox.Show(ex.Message); 67 | } 68 | 69 | } 70 | 71 | private void ValidateInputs() 72 | { 73 | string customerName = txtCustomerName.Text; 74 | if (string.IsNullOrEmpty(customerName)) 75 | throw new Exception("Customer Name is required."); 76 | 77 | if(OrderItems.Count == 0) 78 | throw new Exception("Items are required."); 79 | 80 | } 81 | 82 | private void btnPrint_Click(object sender, EventArgs e) 83 | { 84 | new PdfGenerator().Generate(Order); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace OrderApp 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("OrderApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("OrderApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("41d1db08-cda9-48b0-a01f-35e1aedc429f")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace OrderApp.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OrderApp/OrderApp/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qadir0108/VisualProgramming/83d2037b52f5159d7c4f6269a8d6b7153aae295d/OrderApp/OrderApp/logo.ico -------------------------------------------------------------------------------- /Programming/Programming.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.35122.118 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Programming", "Programming\Programming.csproj", "{E9B434B1-9802-471A-9885-BDB86898A3E2}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {E9B434B1-9802-471A-9885-BDB86898A3E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {E9B434B1-9802-471A-9885-BDB86898A3E2}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {E9B434B1-9802-471A-9885-BDB86898A3E2}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {E9B434B1-9802-471A-9885-BDB86898A3E2}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {47572F47-FA90-40D1-9851-94089C9C3A6F} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Programming/Programming/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Programming/Programming/Calculator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Programming 4 | { 5 | public class Calculator 6 | { 7 | public int add(int a, int b) 8 | { 9 | return a + b; 10 | } 11 | 12 | public void print(int a) 13 | { 14 | Console.WriteLine("Final Result: " + a); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Programming/Programming/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Programming 4 | { 5 | public class Program 6 | { 7 | static void Main(string[] args) 8 | { 9 | Console.WriteLine("Welcome to Visual Programming"); 10 | 11 | // 1. Variables 12 | Console.Write("Enter Name: "); 13 | string name = Console.ReadLine(); 14 | Console.Write("Enter Marks: "); 15 | int marks = int.Parse(Console.ReadLine()); 16 | Console.WriteLine("Name:" + name + "\tMarks:" + marks); 17 | 18 | // 2. Conditions 19 | if (marks >= 50) 20 | Console.WriteLine(name + " is PASS"); 21 | else 22 | Console.WriteLine(name + " is FAIL"); 23 | 24 | // 3. Loops 25 | for (int i = 0; i < 5; i++) 26 | Console.WriteLine(name); 27 | 28 | // 4. Arrays 29 | int[] arr = new int[5]; 30 | for (int i = 0; i < arr.Length; i++) 31 | { 32 | arr[i] = Convert.ToInt32(Console.ReadLine()); 33 | } 34 | 35 | int sum = 0; 36 | for (int i = 0; i < arr.Length; i++) 37 | { 38 | sum = sum + arr[i]; 39 | } 40 | Console.WriteLine("Total Marks: " + sum + " out of 500"); 41 | 42 | // 5. Functions 43 | int result = add(10, 5); 44 | Console.WriteLine(result); 45 | 46 | // 6. Objects 47 | Calculator obj = new Calculator(); 48 | int x = obj.add(10, 5); 49 | obj.print(x); 50 | 51 | Console.ReadLine(); 52 | } 53 | 54 | public static int add(int a, int b) 55 | { 56 | return a + b; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Programming/Programming/Programming.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {E9B434B1-9802-471A-9885-BDB86898A3E2} 8 | Exe 9 | Programming 10 | Programming 11 | v4.8 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Programming/Programming/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Programming")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Programming")] 13 | [assembly: AssemblyCopyright("Copyright © 2024")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("e9b434b1-9802-471a-9885-bdb86898a3e2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.4.33110.190 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QRCodeApp", "QRCodeApp\QRCodeApp.csproj", "{D9ACADE8-C4C4-4CF5-AF61-C3C64FEC6E35}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D9ACADE8-C4C4-4CF5-AF61-C3C64FEC6E35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D9ACADE8-C4C4-4CF5-AF61-C3C64FEC6E35}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D9ACADE8-C4C4-4CF5-AF61-C3C64FEC6E35}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D9ACADE8-C4C4-4CF5-AF61-C3C64FEC6E35}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {40E96D3A-5A78-4BC1-B96E-3EBC48BAC514} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace QRCodeApp 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.pictureBox1 = new System.Windows.Forms.PictureBox(); 32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); 33 | this.SuspendLayout(); 34 | // 35 | // pictureBox1 36 | // 37 | this.pictureBox1.Location = new System.Drawing.Point(261, 94); 38 | this.pictureBox1.Name = "pictureBox1"; 39 | this.pictureBox1.Size = new System.Drawing.Size(301, 252); 40 | this.pictureBox1.TabIndex = 0; 41 | this.pictureBox1.TabStop = false; 42 | // 43 | // Form1 44 | // 45 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 47 | this.ClientSize = new System.Drawing.Size(800, 450); 48 | this.Controls.Add(this.pictureBox1); 49 | this.Name = "Form1"; 50 | this.Text = "Form1"; 51 | this.Load += new System.EventHandler(this.Form1_Load); 52 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); 53 | this.ResumeLayout(false); 54 | 55 | } 56 | 57 | #endregion 58 | 59 | private System.Windows.Forms.PictureBox pictureBox1; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using ZXing; 11 | 12 | namespace QRCodeApp 13 | { 14 | public partial class Form1 : Form 15 | { 16 | public Form1() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void Form1_Load(object sender, EventArgs e) 22 | { 23 | var writer = new BarcodeWriter(); 24 | writer.Format = BarcodeFormat.QR_CODE; 25 | writer.Options = new ZXing.QrCode.QrCodeEncodingOptions 26 | { 27 | Height = 200, 28 | Width = 200, 29 | }; 30 | Bitmap image = writer.Write("BSIT"); 31 | pictureBox1.Image = image; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace QRCodeApp 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("QRCodeApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("QRCodeApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d9acade8-c4c4-4cf5-af61-c3c64fec6e35")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace QRCodeApp.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /QRCodeApp/QRCodeApp/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Visual Programming 4 | For students to understand Visual Programming in C# 5 | 6 | **Console App First** 7 | - Hello World 8 | - Classes 9 | - Data Type Conversion 10 | - Nullable Data Type 11 | - Enumeration 12 | - Exception Handling 13 | 14 | **Programming Revision** 15 | - Programming Project 16 | 17 | **Windows Forms App First** 18 | 19 | **Chapter #16: Strings** 20 | - Creating String 21 | - String Compare, Contains, Substring, Join 22 | 23 | **Chapter #20: Inheritance** 24 | - Parent Child Class (Shape & Rectangle) 25 | - Initilize Parent class (Constructor & Function) 26 | - Multiple Inheritance using Interfaces 27 | - Inheritance.pdf 28 | - Inheritance Project 29 | 30 | **Chapter #21: Polymorphism** 31 | - Function Overloading 32 | - Abstract Class 33 | - Polymorphism 34 | 35 | **Chapter #23: Interfaces** 36 | - Interfaces.pdf 37 | - Interfaces Project 38 | 39 | **Chapter #35: Collections** 40 | - ArrayList 41 | - HashTable 42 | - SortedList 43 | - Stack 44 | - Queue 45 | - BitArray 46 | 47 | **Student Admission System** 48 | - UI Design 49 | - Class Library Project 50 | - Code: Student, Student Manager 51 | 52 | **Chapter #28: File IO** 53 | - FileStream 54 | - StreamReader & StreamWriter 55 | - BinaryReader & BinaryWriter 56 | - DirectoryInfo & FileInfo 57 | 58 | **Chapter #33: Delegates** 59 | - Delegate 60 | - Delegate Multicast 61 | - Delegate Usage 62 | - System Timer 63 | 64 | ~~**Chapter #34: Events**~~ 65 | ~~- Delegate & Event~~ 66 | ~~- Windows Form EventHandler~~ 67 | ~~- Winforms App First~~ 68 | 69 | **Chapter #36: Generics** 70 | - Generic Class 71 | - Generic Function 72 | 73 | **Chapter #39: Threading** 74 | - MainThread 75 | - Creating Thread (aka. Thread Spawning) 76 | - Managing Thread 77 | - Destroying Thread 78 | 79 | **QRCode App** 80 | - Nuget Package Managment 81 | 82 | **Bzu Shop Database** 83 | 84 | **Order App** 85 | - Example Winforms App 86 | - Connects with SQL Server 87 | 88 | **Setup Project** 89 | - https://www.advancedinstaller.com/create-msi-installer-with-visual-studio.html 90 | 91 | **WPF App First** 92 | 93 | **ORM - Object Relationship Mapping** 94 | 95 | **Language Integrated Query (LINQ)** 96 | - https://www.tutorialsteacher.com/linq -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("StudentAdmissionSystem.Data")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("StudentAdmissionSystem.Data")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8b4fa3d7-51b0-4e82-abb3-4a38d6f6f416")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem.Data/Student.cs: -------------------------------------------------------------------------------- 1 | namespace StudentAdmissionSystem.Data 2 | { 3 | public class Student 4 | { 5 | public long CNIC { get; set; } 6 | public string FirstName { get; set; } 7 | public string LastName { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem.Data/StudentAdmissionSystem.Data.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416} 8 | Library 9 | Properties 10 | StudentAdmissionSystem.Data 11 | StudentAdmissionSystem.Data 12 | v4.8 13 | 512 14 | true 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem.Data/StudentManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace StudentAdmissionSystem.Data 9 | { 10 | public class StudentManager 11 | { 12 | static List students = new List(); 13 | 14 | public void Add(long _cnic, string _firstName, string _lastName) 15 | { 16 | Student student = new Student(); 17 | student.CNIC = _cnic; 18 | student.FirstName = _firstName; 19 | student.LastName = _lastName; 20 | students.Add(student); 21 | } 22 | 23 | public List GetAll() 24 | { 25 | return students; 26 | //{ 27 | // Debug.WriteLine("CNIC : " + student.CNIC); 28 | // Debug.WriteLine("First : " + student.FirstName); 29 | // Debug.WriteLine("Last : " + student.LastName); 30 | //} 31 | } 32 | 33 | // 123 34 | public Student Search(long cnic) 35 | { 36 | Student found = null; 37 | foreach (Student student in students) 38 | { 39 | if (student.CNIC == cnic) 40 | found = student; 41 | } 42 | return found; 43 | } 44 | 45 | // 111 46 | public bool Delete(long cnic) 47 | { 48 | // Search 49 | Student found = Search(cnic); 50 | 51 | // Delete 52 | if (found == null) 53 | return false; 54 | else 55 | { 56 | students.Remove(found); 57 | return true; 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32929.385 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentAdmissionSystem", "StudentAdmissionSystem\StudentAdmissionSystem.csproj", "{AE461E26-124C-49F3-9D91-8CC798881938}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentAdmissionSystem.Data", "StudentAdmissionSystem.Data\StudentAdmissionSystem.Data.csproj", "{8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {AE461E26-124C-49F3-9D91-8CC798881938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {AE461E26-124C-49F3-9D91-8CC798881938}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {AE461E26-124C-49F3-9D91-8CC798881938}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {AE461E26-124C-49F3-9D91-8CC798881938}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {8B4FA3D7-51B0-4E82-ABB3-4A38D6F6F416}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {62D526EF-F547-4AA7-A5D6-21475EC03BAA} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace StudentAdmissionSystem 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frmProfile()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("StudentAdmissionSystem")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("StudentAdmissionSystem")] 13 | [assembly: AssemblyCopyright("Copyright © 2022")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ae461e26-124c-49f3-9d91-8cc798881938")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace StudentAdmissionSystem.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/frmLogin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace StudentAdmissionSystem 12 | { 13 | public partial class frmLogin : Form 14 | { 15 | public frmLogin() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void button1_Click(object sender, EventArgs e) 21 | { 22 | frmQulification frmQulification = new frmQulification(); 23 | frmQulification.Show(); 24 | 25 | this.Hide(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /StudentAdmissionSystem/StudentAdmissionSystem/frmQulification.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace StudentAdmissionSystem 12 | { 13 | public partial class frmQulification : Form 14 | { 15 | public frmQulification() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /WinformsAppFirst/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /WinformsAppFirst/Dashboard.Designer.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace WinformsAppFirst 3 | { 4 | partial class Dashboard 5 | { 6 | /// 7 | /// Required designer variable. 8 | /// 9 | private System.ComponentModel.IContainer components = null; 10 | 11 | /// 12 | /// Clean up any resources being used. 13 | /// 14 | /// true if managed resources should be disposed; otherwise, false. 15 | protected override void Dispose(bool disposing) 16 | { 17 | if (disposing && (components != null)) 18 | { 19 | components.Dispose(); 20 | } 21 | base.Dispose(disposing); 22 | } 23 | 24 | #region Windows Form Designer generated code 25 | 26 | /// 27 | /// Required method for Designer support - do not modify 28 | /// the contents of this method with the code editor. 29 | /// 30 | private void InitializeComponent() 31 | { 32 | this.label1 = new System.Windows.Forms.Label(); 33 | this.SuspendLayout(); 34 | // 35 | // label1 36 | // 37 | this.label1.AutoSize = true; 38 | this.label1.Font = new System.Drawing.Font("Segoe Script", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 39 | this.label1.ForeColor = System.Drawing.Color.Blue; 40 | this.label1.Location = new System.Drawing.Point(63, 164); 41 | this.label1.Name = "label1"; 42 | this.label1.Size = new System.Drawing.Size(742, 133); 43 | this.label1.TabIndex = 0; 44 | this.label1.Text = "Welcome to BZU"; 45 | // 46 | // Dashboard 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.ClientSize = new System.Drawing.Size(857, 450); 51 | this.Controls.Add(this.label1); 52 | this.Name = "Dashboard"; 53 | this.Text = "Dashboard"; 54 | this.ResumeLayout(false); 55 | this.PerformLayout(); 56 | 57 | } 58 | 59 | #endregion 60 | 61 | private System.Windows.Forms.Label label1; 62 | } 63 | } -------------------------------------------------------------------------------- /WinformsAppFirst/Dashboard.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace WinformsAppFirst 12 | { 13 | public partial class Dashboard : Form 14 | { 15 | public Dashboard() 16 | { 17 | InitializeComponent(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /WinformsAppFirst/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace WinformsAppFirst 12 | { 13 | public partial class MainForm : Form 14 | { 15 | public MainForm() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | private void btnLogin_Click(object sender, EventArgs e) 21 | { 22 | // Check Login Username & Password 23 | if(txtUserName.Text == "admin" && txtPassword.Text == "admin") 24 | { 25 | //lblMessage.Text = "Welcome " + txtUserName.Text + "!"; 26 | 27 | Dashboard obj = new Dashboard(); 28 | obj.Show(); 29 | this.Hide(); 30 | } 31 | else 32 | { 33 | MessageBox.Show("Please enter correct Username and Password"); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /WinformsAppFirst/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace WinformsAppFirst 8 | { 9 | internal static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /WinformsAppFirst/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("WinformsAppFirst")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("WinformsAppFirst")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("14207c86-ac78-45cf-9450-1f521979c5bd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WinformsAppFirst/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WinformsAppFirst.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /WinformsAppFirst/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /WinformsAppFirst/WinformsAppFirst.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31912.275 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinformsAppFirst", "WinformsAppFirst.csproj", "{14207C86-AC78-45CF-9450-1F521979C5BD}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {14207C86-AC78-45CF-9450-1F521979C5BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {14207C86-AC78-45CF-9450-1F521979C5BD}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {14207C86-AC78-45CF-9450-1F521979C5BD}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {14207C86-AC78-45CF-9450-1F521979C5BD}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {CFAD117E-82B0-4506-BCD6-6E803764AD7A} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /WpfAppFirst/WpfAppFirst.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31613.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfAppFirst", "WpfAppFirst\WpfAppFirst.csproj", "{1D6F86BA-BD90-48D8-AE59-E70650706A10}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {1D6F86BA-BD90-48D8-AE59-E70650706A10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {1D6F86BA-BD90-48D8-AE59-E70650706A10}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {1D6F86BA-BD90-48D8-AE59-E70650706A10}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {1D6F86BA-BD90-48D8-AE59-E70650706A10}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D566D756-C708-43D7-8095-4DCE0D681F90} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /WpfAppFirst/WpfAppFirst/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /WpfAppFirst/WpfAppFirst/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace WpfAppFirst 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /WpfAppFirst/WpfAppFirst/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /WpfAppFirst/WpfAppFirst/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 |