using
System;
using
System.Globalization;
using
System.Reflection;
public
class
Student {
private
string
name, dept;
private
int
roll;
public
Student(
string
name,
int
roll,
string
dept)
{
this
.name = name;
this
.roll = roll;
this
.dept = dept;
}
public
string
getName()
{
return
name;
}
public
int
getRoll()
{
return
roll;
}
public
string
getDept()
{
return
dept;
}
}
class
GFG {
public
static
void
Main()
{
Type objType =
typeof
(Student);
try
{
MethodInfo[] info = objType.GetMethods(BindingFlags.Public | BindingFlags.Instance);
Console.WriteLine(
"Methods of current type is as Follow: "
);
for
(
int
i = 0; i < info.Length; i++)
Console.WriteLine(
" {0}"
, info[i]);
}
catch
(ArgumentNullException e)
{
Console.Write(
"name is null."
);
Console.Write(
"Exception Thrown: "
);
Console.Write(
"{0}"
, e.GetType(), e.Message);
}
}
}