mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50: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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Mono.CecilX;
|
||||
|
||||
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)
|
||||
{
|
||||
List<MethodDefinition> methods = new List<MethodDefinition>();
|
||||
foreach (MethodDefinition md in td.Methods)
|
||||
{
|
||||
if (md.Name == methodName)
|
||||
methods.Add(md);
|
||||
}
|
||||
return methods;
|
||||
// Linq allocations don't matter in weaver
|
||||
return td.Methods.Where(method => method.Name == methodName).ToList();
|
||||
}
|
||||
|
||||
public static MethodDefinition GetMethodInBaseType(this TypeDefinition td, string methodName)
|
||||
|
Loading…
Reference in New Issue
Block a user