private static CompressBuffer FindCompressBuffer()

in src/DotPulsar/Internal/Compression/ZlibCompression.cs [78:98]


    private static CompressBuffer FindCompressBuffer(MethodInfo[] methods)
    {
        const string name = "CompressBuffer";

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

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

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

            return (CompressBuffer) method.CreateDelegate(typeof(CompressBuffer));
        }

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