Skip to content

Commit

Permalink
cleanup CallbackDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed May 11, 2024
1 parent dfd358b commit 459a7c4
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/ApprovalUtilities/Reflection/CallbackDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,29 @@ namespace ApprovalUtilities.Reflection;

public class CallbackDescriptor
{
List<MethodInfo> Methods = new();
List<MethodInfo> methods = new();

public void AddMethods(IEnumerable<MethodInfo> methods)
{
foreach (var m in methods)
{
AddMethod(m);
}
}
public void AddMethods(IEnumerable<MethodInfo> methods) =>
this.methods.AddRange(methods);

public CallbackDescriptor(string name) =>
EventName = name;

public string EventName { get; private set; }
public string EventName { get; }

public void AddMethod(MethodInfo method) =>
Methods.Add(method);
methods.Add(method);

public List<MethodInfo> GetMethods() => Methods;
public List<MethodInfo> GetMethods() => methods;

public override string ToString()
{
var builder = new StringBuilder();
builder.AppendLine($"{EventName}:");

for (var i = 0; i < Methods.Count; i++)
for (var i = 0; i < methods.Count; i++)
{
builder.AppendLine($"\t[{i}] {Methods[i]}");
builder.AppendLine($"\t[{i}] {methods[i]}");
}

return builder.ToString();
Expand Down

0 comments on commit 459a7c4

Please sign in to comment.