private static MethodInfo FindWrap()

in src/DotPulsar/Internal/Compression/ZstdSharpCompression.cs [119:139]


    private static MethodInfo FindWrap(MethodInfo[] methods)
    {
        const string name = "Wrap";

        foreach (var method in methods)
        {
            if (method.Name != name || method.ReturnType != typeof(Span<byte>))
                continue;

            var parameters = method.GetParameters();
            if (parameters.Length != 1)
                continue;

            if (parameters[0].ParameterType != typeof(ReadOnlySpan<byte>))
                continue;

            return method;
        }

        throw new Exception($"A method with the name '{name}' matching the delegate was not found");
    }