private void Collect(MethodDefinition meth, MethodReference mref) { GenericInstanceMethod genMeth = null; if (Methods.Contains(meth) || ((genMeth = mref as GenericInstanceMethod) != null && GenericMethods.Contains(genMeth))) { return; } if (genMeth != null) { GenericMethods.Add(genMeth); } else { Methods.Add(meth); } Collect(genMeth?.ReturnType ?? meth.ReturnType); foreach (var param in genMeth?.Parameters ?? meth.Parameters) { Collect(param); } if (meth.HasBody) { Collect(meth.Body); } }