reflection-method-call

Invoke static or instance C# methods dynamically using a method reference and parameters.

Updated Feb 4, 2024
One-click install
npx skills add https://github.com/sprillion/gem_td --skill reflection-method-call-sprillion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reflection-method-call
Source: https://github.com/sprillion/gem_td/tree/main/SKILLS/reflection-method-call
Command: npx skills add https://github.com/sprillion/gem_td --skill reflection-method-call-sprillion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Call C# methods dynamically, including private ones, when provided with a proper method schema, enabling advanced testing, debugging, and runtime integration without modifying source code.

Core Features & Use Cases

  • Dynamic method invocation: Call static or instance methods using a supplied MethodRef and input parameters.
  • Private method access: Access non-public methods when allowed by the method schema, facilitating deep validation and debugging.
  • Method discovery: Use 'reflection-method-find' to locate available methods before invocation, reducing guesswork.
  • Use Case: Validate internal APIs, orchestrate component interactions, or perform on-the-fly diagnostics in a running application.

Quick Start

Provide a valid MethodRef and inputParameters to call the target method and receive the result.

Frequently Asked Questions about reflection-method-call

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I invoke private C# methods dynamically at runtime?

You can invoke private C# methods dynamically by supplying a proper method schema along with a method reference and input parameters. This approach enables deep validation and debugging without modifying the source code.

Can I call both static and instance C# methods using reflection?

Yes, you can call both static and instance C# methods using reflection. You must provide a valid method reference and the required input parameters to execute the dynamic call and receive the serialized result.

What is the best way to discover available C# methods before a dynamic call?

The best way to discover available methods is to use the reflection-method-find feature to locate target methods beforehand. This reduces guesswork by validating the method schema before you attempt the actual invocation.

How do I execute C# reflection calls on the main thread?

You can control execution context for C# reflection calls by setting the executeInMainThread flag. This ensures dynamic method invocations run safely on the main thread when orchestrating component interactions.

Does dynamic C# method invocation support configurable type matching?

Yes, dynamic C# method invocation supports configurable matching levels for both type and method names. This flexibility allows precise targeting during API testing and runtime integration tasks.

What format are C# reflection method results returned in?

C# reflection method results are returned as serialized objects. This format allows you to easily inspect outputs from dynamic invocations, including private method calls, for diagnostics and validation.