Creating methods with infinite overloads ? (.NET)
- by MarceloRamires
In C# you can do this:
foo = string.Format("{0} {1} {2} {3} ...", "aa", "bb", "cc" ...);
This method Format() accepts infinite parameters, being the first one how the string should be formatted and the rest are values to be put in the string.
Today I've come to a situation where I had to get a set of strings and test them, then I remembered this language functionality, but I had no clue. After a few unsuccessful web searches, I've realised it would be more prudent to just get an array, which didn't make me quite satisfied.
Q: How do I make a function that accepts infinite parameters? And how do I use it ?