private static Decode FindDecode()

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


    private static Decode FindDecode(MethodInfo[] methods)
    {
        const string name = "Decode";

        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(ReadOnlySpan<byte>))
                continue;

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

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