I have this following list:
var myList = new List<KeyValuePair<string, object>>();
And this function:
public void Test(params KeyValuePair<string, object>[] list)
How can I do a conversion of the list to params when using the function? Like that:
Test(myList);
You method declaration KeyValuePair<string, object>[] list
states that it will accept an array so you need to convert your list to array like this
Test(myList.ToArray());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With