-
Notifications
You must be signed in to change notification settings - Fork 0
/
MethodSignature.cs
42 lines (32 loc) · 1.47 KB
/
MethodSignature.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Mono.Cecil;
using System.Linq;
namespace Cecil.AspectN
{
public class MethodSignature
{
public MethodSignature(MethodDefinition definition, Modifier modifiers, TypeSignature returnType, TypeSignature declareType, GenericSignature method, TypeSignature[] methodParameters, AttributeSignatures attributes)
{
Definition = definition;
Modifiers = modifiers;
ReturnType = returnType;
DeclareType = declareType;
Method = method;
MethodParameters = methodParameters;
Attributes = attributes;
}
public MethodDefinition Definition { get; }
public Modifier Modifiers { get; }
public TypeSignature ReturnType { get; }
public TypeSignature DeclareType { get; }
public GenericSignature Method { get; }
public TypeSignature[] MethodParameters { get; }
public AttributeSignatures Attributes { get; }
public override string ToString()
{
var modifiers = Modifiers.ToDefinitionString();
var methodGenericParameter = Method.Generics.Length == 0 ? string.Empty : $"<{string.Join(",", Method.Generics.AsEnumerable())}>";
var methodParameters = MethodParameters.Length == 0 ? string.Empty : string.Join(",", MethodParameters.AsEnumerable());
return $"{modifiers} {ReturnType} {DeclareType}.{Method.Name}{methodGenericParameter}({methodParameters})";
}
}
}