22.2. Browsing and Querying Members

As you have seen, with 124 methods to browse it can quickly become tedious trying to find the right method with the right signature. Unlike Java, C# provides an API that gives you methods for selecting and searching for a set of members based on certain criteria. The criteria you specify are typically member modifiers that precede the member definition; examples include static, public, and private methods, fields, and constructors.

Listing 22.2 shows how to browse and query fields and methods of any C# type. The FindMembers method of the MemberInfo class can be used to narrow the search. The parameters of this method are MemberTypes, BindingFlags, MemberFilter, and Object. Let's explore the meanings of these ...

Get .NET for Java Developers: Migrating to C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.