The GetMembers method returns the members of a type.
Consider the following class:
using System;
using System.Reflection;
using System.Collections.Generic;
class MyClass
{
private bool v;
public void MyValue() { v = true; }
}
class Program
{
static void Main()
{
//We can reflect on its public members as follows:
MemberInfo[] members = typeof(MyClass).GetMembers();
foreach (MemberInfo m in members) {
Console.WriteLine(m);
}
}
}
The output:
Void MyValue()
System.String ToString()
Boolean Equals(System.Object)
Int32 GetHashCode()
System.Type GetType()
Void .ctor()