why does params byte[] argument doesnt work?

i have this method from a pattern scanner

public static int FindPFM(int Module,long ModuleL,int Offset,params byte[] pattern)
    {

        string mask = MaskFromPattern(pattern);
        int address, val1, val2;

        address = FindAddress(pattern, 3, mask, Module, ModuleL);
        val1 = ReadInt32(scanner.Process.Handle, address);
        address = FindAddress(pattern, 18, mask, Module, ModuleL);
        val2 = ReadByte(scanner.Process.Handle, address);
        val1 = val1 + val2 - Module;
        Offset = val1;
        return Offset;
    }

using params and b

        localPlayer = FindPFM((0x8D, 0x34, 0x85, 0x00, 0x00, 0x00, 0x00, 0x89, 0x15, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x41, 0x08, 0x8B, 0x48, 0x00), dllClientAddress, dllClientSize, localPlayer);

when i use it but it says : "cannot convert int int int .... to byte" but 0x8D is 1 byte and that is a vector of bytes, why that error appears then?

Edit 1: i've tried doing this

        localPlayer = FindPFM(new byte[] { 0x8D, 0x34, 0x85, 0x00, 0x00, 0x00, 0x00, 0x89, 0x15, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x41, 0x08, 0x8B, 0x48, 0x00 }, dllClientAddress, dllClientSize, localPlayer);

but it also didnt worked.

Jon Skeet
people
quotationmark

When you invoke a method with a parameter array, the arguments go at the end, not the beginning (to match the parameter array position). Next, the arguments don't go in parentheses as you've tried to do - that's the syntax for a C# 7 tuple literal. It's slightly tricky to tell from the parameter names and the argument names, but I think you want:

localPlayer = FindPFM(dllClientAddress, dllClientSize, localPlayer,
     0x8D, 0x34, 0x85, 0x00, 0x00, 0x00, 0x00, 0x89, 0x15, 0x00,
     0x00, 0x00, 0x00, 0x8B, 0x41, 0x08, 0x8B, 0x48, 0x00);

Here's a complete example::

using System;

public class Test
{
    static void Main()
    {
        Foo(10, 20, 0x80, 0x8d, 0xff);
    }

    static void Foo(int x, int y, params byte[] bytes)
    {
        Console.WriteLine($"x: {x}");
        Console.WriteLine($"y: {y}");
        Console.WriteLine($"bytes: {BitConverter.ToString(bytes)}");
    }
}

people

See more on this question at Stackoverflow