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.
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 well be grinding your teeth in frustration at this sentence. After all, the object-oriented approach to solving this problem is to define overloaded methods.
Overloading is the technical term for declaring two or more methods with the same name ...
Get Microsoft® Visual C#® 2008 Step by Step 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.