ContextualMethodInfo
A method info with contextual information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Namotion.Reflection
{
[System.Runtime.CompilerServices.NullableContext(1)]
[System.Runtime.CompilerServices.Nullable(0)]
public class ContextualMethodInfo : ContextualMemberInfo
{
public MethodInfo MethodInfo { get; }
public override string Name => MethodInfo.Name;
public ContextualParameterInfo[] Parameters { get; }
public ContextualParameterInfo ReturnParameter { get; }
public override MemberInfo MemberInfo => MethodInfo;
internal ContextualMethodInfo(MethodInfo methodInfo, ContextualParameterInfo returnParameter, IEnumerable<ContextualParameterInfo> parameters)
{
MethodInfo = methodInfo;
ReturnParameter = returnParameter;
Parameters = parameters.ToArray();
}
public override string ToString()
{
return Name + " (" + GetType().Name.Replace("Contextual", "").Replace("Info", "") + ") - " + base.ToString();
}
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{
return MethodInfo.GetCustomAttributes(attributeType, inherit);
}
public override object[] GetCustomAttributes(bool inherit)
{
return MethodInfo.GetCustomAttributes(inherit);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
return MethodInfo.IsDefined(attributeType, inherit);
}
}
}