C# Programming Lab Exercises

This repository contains C# programming lab exercises categorized by labs.

Lab 1

  1. Write a C# program to get numeric input in two variables and calculate the sum.
  2. Write a C# program to show logical if.. else if and else to show following:
    • If marks >=80 to marks <=100, show A
    • If marks >=60 to marks <80, show B
    • If marks >=40 to marks < 60, show C
    • If marks <40, show F
  3. Write a C# program to show the multiplication table of a given number.

Lab 2

  1. Write a C# program to create an array with 5 items and calculate the sum of these numbers using for loop and foreach loop.
  2. Write a program to show function overloading in C#.

Lab 3

  1. Create a class "Employee" with the following specs:
    • Field Members: firstName, lastName, salary
    • Properties: FirstName, LastName, Salary
    • Methods: ShowFullName, IncrementSalary(double s)
    • Constructor: Employee(__ , ___ , ___)
    • Now, create an object of Employee("Ram", "Bahadur", 20000)
    • Show Employee Fullname & Salary
    • Change FirstName to "Hari" & increment salary by 5000
    • Show full name & salary
  2. Write a C# program to show Operator Overloading.

Lab 4

  1. Write a program to show Inheritance in C#.
  2. Write a program to show the use of interface and multiple inheritances in C#.
  3. Write a C# program to show the use of Indexer.

Lab 5

  1. Write a program to show the use of Collection and Generics with ArrayList and List.
  2. Write a program to Handle DivideByZeroException and IndexOutOfRangeException.
  3. Write a LINQ query:
    • First create a List of strings with 4 string values
    • Get and show all strings from List with LINQ
    • Filter and show the list containing the matching string text.

Lab 6

  1. Write a program using C# to:
    • Insert data into a Database Table.
    • Display Data from your table.
    • Update data in your table.

Lab 7

  1. Write a program using ASP.NET to create a form with the following basic form controls and display entered and selected items on button click:
    • TextBox
    • RadioButton
    • Checkbox