Table of Contents

ParameterSignature Class

Definition

Namespace
Cuemon.Reflection
Assemblies
Cuemon.Core.dll
Source
src/Cuemon.Core/Reflection/ParameterSignature.cs

Represent the signature of a parameter to a method, property or similar.

public sealed class ParameterSignature
Inheritance
object
ParameterSignature

Examples

The following example demonstrates how to use to extract parameter information from a method.

using System;
using System.Linq;
using System.Reflection;
using Cuemon.Reflection;

namespace MyApp.Examples;

public class ParameterSignatureExample
{
    public void Demonstrate()
    {
        MethodInfo method = typeof(string).GetMethod("IndexOf", new[] { typeof(string), typeof(StringComparison) });

        if (method != null)
        {
            var signatures = ParameterSignature.Parse(method).ToList();

            foreach (var signature in signatures)
            {
                Console.WriteLine($"Parameter: {signature.ParameterName}, Type: {signature.ParameterType.Name}");

}}}
}

Constructors

Name Description
ParameterSignature(Type, string)

Initializes a new instance of the ParameterSignature class.

Properties

Name Description
ParameterName

Gets the name of the parameter.

ParameterType

Gets the Type of the parameter.

Methods

Name Description
Parse(IEnumerable<ParameterInfo>)

Converts the specified ParameterInfo sequence to its IEnumerable<T> equivalent.

Parse(MethodBase)

Extracts and converts the ParameterInfo sequence to its IEnumerable<T> equivalent from GetParameters().