-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
53 lines (45 loc) · 1.56 KB
/
Program.cs
File metadata and controls
53 lines (45 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using CSHReflection.Models;
using System;
using System.Reflection;
namespace CSHReflection
{
class Program
{
static void Main(string[] args)
{
Type type = typeof(Customer);
//Getting a class's properties:
PropertyInfo[] propertyInfo = type.GetProperties();
Console.WriteLine("The list of properties of the Customer class are:--");
foreach (PropertyInfo pInfo in propertyInfo)
{
Console.WriteLine(pInfo.Name);
}
Console.WriteLine("\n");
//Getting class's constructors:
ConstructorInfo[] constructorInfo = type.GetConstructors();
Console.WriteLine("The Customer class contains the following Constructors:--");
foreach (ConstructorInfo c in constructorInfo)
{
Console.WriteLine(c);
}
Console.WriteLine("\n");
MethodInfo[] methodInfo = type.GetMethods();
Console.WriteLine("The methods of the Customer class are:--");
foreach (MethodInfo temp in methodInfo)
{
Console.WriteLine(temp.Name);
}
Console.WriteLine("\n");
Console.WriteLine("Methods' Attributes:");
foreach (MethodInfo temp in methodInfo)
{
foreach (Attribute attribute in temp.GetCustomAttributes(true))
{
Console.WriteLine(attribute);
}
}
Console.Read();
}
}
}