How to refactor a method with many prameters that sets a bit array I've written a method that is going to set a bit array by passing bool parameters to be able send correct command
private byte _mode;

     public void SetConfiguration(
            bool mode1,
            bool mode2,
            bool mode3,
            bool mode4,
            bool mode5,
            bool mode6,
            bool mode7,
            bool mode8)
        {
            var setBits = new BitArray(8);

            setBits.Set(0, mode1);
            setBits.Set(1, mode2);
            setBits.Set(2, mode3);
            setBits.Set(3, mode4);
            setBits.Set(4, mode5);
            setBits.Set(5, mode6);
            setBits.Set(6, mode7);
            setBits.Set(7, mode8);

            byte[] byteSet = new byte[1];
            setBits.CopyTo(byteSet, 0);
            _mode = byteSet[0];
        }

So depending on what command the application is sending I am going to set it with boolean. What bothers me is that the method has too many bool parameters and I'm wondering if anyone have an idea how to write this in a better way
You could use a params array to pass the parameters
public void SetConfiguration(params bool[] modes)
{
    var setBits = new BitArray(8);

    for (int i = 0; i &lt; modes.Length; i++)
    {
        setBits.Set(i, modes[i]);
    }

    byte[] byteSet = new byte[1];
    setBits.CopyTo(byteSet, 0);
    _mode = byteSet[0];
}

You might want to add tests to ensure modes is not longer than 8 or you could expand the code to automatically set more than one byte in such cases. Shorter should be okay.
You can call it with individual parameters or with a bool array.
SetConfiguration(false, true, true, false, true, true, true, false);

var modes = new bool[] {false, true, true, false, true, true, true, false};
SetConfiguration(modes);