mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Weaver Extensions: GetMethods uses Linq to simplify code
This commit is contained in:
parent
687c9002dd
commit
045b50a929
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Mono.CecilX;
|
using Mono.CecilX;
|
||||||
|
|
||||||
namespace Mirror.Weaver
|
namespace Mirror.Weaver
|
||||||
@ -211,13 +212,8 @@ public static MethodDefinition GetMethod(this TypeDefinition td, string methodNa
|
|||||||
|
|
||||||
public static List<MethodDefinition> GetMethods(this TypeDefinition td, string methodName)
|
public static List<MethodDefinition> GetMethods(this TypeDefinition td, string methodName)
|
||||||
{
|
{
|
||||||
List<MethodDefinition> methods = new List<MethodDefinition>();
|
// Linq allocations don't matter in weaver
|
||||||
foreach (MethodDefinition md in td.Methods)
|
return td.Methods.Where(method => method.Name == methodName).ToList();
|
||||||
{
|
|
||||||
if (md.Name == methodName)
|
|
||||||
methods.Add(md);
|
|
||||||
}
|
|
||||||
return methods;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MethodDefinition GetMethodInBaseType(this TypeDefinition td, string methodName)
|
public static MethodDefinition GetMethodInBaseType(this TypeDefinition td, string methodName)
|
||||||
|
Loading…
Reference in New Issue
Block a user