CHAPTER 11
Understanding parameter arrays
After completing this chapter, you will be able to:
Write a method that can accept any number of arguments by using the params keyword.
Write a method that can accept any number of arguments of any type by using the params keyword in combination with the object type.
Explain the differences between methods that take parameter arrays and methods that take optional parameters.
Parameter arrays are useful if you want to write methods that can take any number of arguments, possibly of different types, as parameters. If you are familiar with object-oriented concepts, you might be grinding your teeth in frustration at the previous sentence. After all, the object-oriented approach to solving this problem is ...
Get Microsoft Visual C# Step by Step, 9th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.