0% found this document useful (0 votes)
6 views2 pages

Lab 7

Lab 7

Uploaded by

jaziljazi2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Lab 7

Lab 7

Uploaded by

jaziljazi2003
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication12
{
class Dept
{
public int id;
public string name;
public void showstudent()
{

foreach (Student student in ListofS)


{
Console.WriteLine("Name : " + student.Name, "Age : " + student.Age,
"Grade : " + student.Grade);
}

}
public List<Student> ListofS;
public void AddList(List<Student> ListofS)
{

this.ListofS = ListofS;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication12
{
class Program
{
static void Main()
{
Student student1 = new Student("Amir", 20, "A");
Student student2 = new Student("Babar", 21, "B");
Student student3 = new Student("imran", 19, "A+");

List<Student> studentList = new List<Student>();

studentList.Add(student1);
studentList.Add(student2);
studentList.Add(student3);
Dept ss1 = new Dept();
ss1.AddList(studentList);
ss1.showstudent();

Console.ReadLine();

}
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication12
{
class Student
{
public string Name;
public int Age;
public string Grade;

public Student(string name, int age, string grade)


{
Name = name;
Age = age;
Grade = grade;
}
}
}

You might also like