With the exception of:
- Change the method signature for accepting an array
- Adding overload, which takes an array, retrieves the values and causes the original overload
- Using reflection to call a method
then unfortunately no, you cannot do this.
Keyword-based and positioning-based parameter passing, like in Python, is not supported in .NET, except for reflection.
, , , , , , , " ?". , , , .NET , , , - , , , .
, , , , , , .NET , .
:
using System;
using System.Reflection;
namespace ConsoleApplication1
{
class Program
{
public Int32 Add(Int32 a, Int32 b) { return a + b; }
static void Main(string[] args)
{
Program obj = new Program();
MethodInfo m = obj.GetType().GetMethod("Add");
Int32 result = (Int32)m.Invoke(obj, new Object[] { 1, 2 });
}
}
}