Get members

When called with no arguments, GetMembers returns all the public members for a type (and its base types).

GetMember retrieves a specific member by name:


using System;
using System.Reflection;
using System.Collections.Generic;

class MyClass
{
    private bool v;
    public void MyValue() { v = true; }
}

class Program
{

    static void Main()
    {
        MemberInfo[] m = typeof(MyClass).GetMember("MyValue");
        Console.WriteLine(m[0]);  // Void MyValue()

    }
}

The output:


Void MyValue()
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.