Pro EP 53:How to create a method with varying number of parameters in C# ?
Published in
Aug 21, 2023
We can achieve this by adding params keyword in our method.
- It only works for single dimensional array
- We can pass N number of params
- Only one param keyword is allowed in method
- If you send no arguments, the length of the params list is zero
- A comma-separated list of arguments of the type of the array elements
Whenever you’re ready, there are 4 ways I can help you
- Subscribe to my Weekly .NET Newsletter of C#/.NET with 7000+ Software Engineers.
- Promote yourself to 7000+ subscribers by Sponsoring my Newsletter
- Download my eBook at Gum Road which contains 30+ .NET Tips (With 2800+ Downloads)
- To get 100+ free and paid resources for learning C# and .NET visit this GitHub Repository