Previous Page
Next Page

Chapter 11 Quick Reference

To

Do this

Write a method that accepts any number of arguments of a given type

Write a method whose parameter is a params array of the given type. For example, a method that accepts any number of bool arguments would be:

someType Method(params bool[] flags) 
{
     ...
}

Write a method that accepts any number of arguments of any type

Write a method whose parameter is a params array of object. For example:

someType Method(params object[] paramList)  
{
     ...
}

Previous Page
Next Page