المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Generics



C# Programming
02-23-2010, 08:11 PM
Hi Friends

I would i like question u all abt Generics. I have read abt Generics but there is a doubt & i would i like to question u using simple program.

public class Student
{

private string name = "satish";
private Int16 RollNo = 12;

public void displayStudent()
{
Console.WriteLine(name);
Console.WriteLine(RollNo);
Console.ReadLine();
}
}




class Program
{
static void Main(string[] args)
{
Student s1 = new Student();
s1.displayStudent();



}
}

If i am right then the above Student class is called Generic class. What is the use of creating a class like this if we are using a method & we are just specifying the Type in angle bracket. so Please help me http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif