MethodSignature Class
Definition
- Namespace
- Cuemon.Reflection
- Assemblies
- Cuemon.Core.dll
Represent the signature of a method in a lightweight format.
public class MethodSignature
- Inheritance
-
objectMethodSignature
Examples
The following example shows how to capture lightweight method metadata for logging or retry evidence.
using System;
using Cuemon.Reflection;
namespace MyApp.Examples;
public static class MethodSignatureExample
{
public static void Demonstrate()
{
var signature = new MethodSignature(
typeof(PaymentGateway).FullName ?? nameof(PaymentGateway),
nameof(PaymentGateway.Authorize),
new[] { typeof(string).Name, typeof(decimal).Name },
new object[] { "INV-42", 19.95m });
Console.WriteLine(signature.ToString());
Console.WriteLine(string.Join(", ", signature.Parameters ?? Array.Empty<string>()));
Console.WriteLine(signature.Arguments?.Length ?? 0);
}
}
public sealed class PaymentGateway
{
public void Authorize(string orderId, decimal amount)
{
}
}
Constructors
| Name | Description |
|---|---|
| MethodSignature(string, string, string[], object[]) | Initializes a new instance of the MethodSignature class. |
Properties
| Name | Description |
|---|---|
| Arguments | Gets the runtime arguments (if any) that was passed to the portrayed method. |
| Caller | Gets the caller of the class where the method portrayed by MethodName is located. |
| MethodName | Gets the name of the portrayed method. |
| Parameters | Gets the parameters (if any) of the portrayed method. |
Methods
| Name | Description |
|---|---|
| ToString() | Returns a string that represents this instance. |