When I want to allow the caller to pass in one or more values as an array, is it more performant to pass it in as a normal array or use the params keyword? Well, both approaches show very similar speeds. Below are examples for comparison.
private void SomeMethod(int count, string[] args)
or
private void SomeMethod(int count, params string[] args)
I recommend using params since it’s easier to use when calling the function.
Benchmark Results
Below are the results for these function calls.


Pick up any books by David McCarter by going to Amazon.com: http://bit.ly/RockYourCodeBooks
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.
DonateDonate monthlyDonate yearlyIf you liked this article, please buy David a cup of Coffee by going here: https://www.buymeacoffee.com/dotnetdave
© The information in this article is copywritten and cannot be preproduced in any way without express permission from David McCarter.
Discover more from dotNetTips.com
Subscribe to get the latest posts sent to your email.

