Microsoft Certified Solutions Developer (MCSD) Certification Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Microsoft Certified Solutions Developer Test with flashcards and multiple choice questions. Each question comes with hints and explanations. Boost your confidence for the exam day!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


Which method is used to get methods of a type using Reflection?

  1. GetMethod

  2. GetMethods

  3. GetAction

  4. GetProperty

The correct answer is: GetMethods

The correct method to retrieve all methods of a specified type using Reflection in .NET is GetMethods. This method is part of the Type class and it provides information about all public methods of a type, including their names, parameter types, return types, and attributes. When you call GetMethods, you receive an array of MethodInfo objects, each of which represents a method defined in the type. Using GetMethods allows developers to dynamically explore types at runtime, which is particularly useful for tasks such as building frameworks, libraries, or applications where understanding or manipulating types and their members is necessary. In contrast, GetMethod is used to retrieve a specific method by name, and it returns a single MethodInfo object rather than an array. GetAction isn't a standard method in the Reflection API, and GetProperty pertains to obtaining information specifically about properties, not methods. Hence, these alternatives do not meet the requirement of listing all methods of a type.