Q:

How do I define a method which can accept different sequences of arguments?

In C#, Python and/or VB.NET, how can I write a method of a class that can accept different sequences of arguments? As an indication, the multiple choices of arguments sequence would be accessible when pressing shift+shift+space in Visual Studio.

A:

I try to be bit more explicit on method overloading and variable parameter numbers. You can have different methods with the same name in the same interface, class or struct as long as they have a different number of parameters or parameters of different types (or both) in C# and VB. C# example:
public int Foo(string s)       // OK, first method
public int Foo(double d)       // OK, different type
public void Foo(double x)      // Error, same parameter type, return
                               // type and parameter name do not matter.
public int Foo(string s, DateTime d)   // OK, diffent number of parameters.

In addition, the last parameter can be an array, which represents a varying number of parameters. It must be introduced with the params keyword (C#) or the ParamArray keyword (VB).
C#
public int Foo(string s, params int[] n)

VB
Function Foo(ByVal s As String, ByVal ParamArray n As Integer()) As Integer 

You can call it like this, C#
int i = Foo("Hello");   
int i = Foo("Hello", 5);   
int i = Foo("Hello", 5, 7);   
int i = Foo("Hello", 5, 7, 13);   
int i = Foo("Hello", new int[] { 2, 4, 6 });   

