C# 関数内の名前付きパラメーターが欠落している場合、コンパイラーは、関数内の欠落している各パラメーターの名前を出力する代わりに、欠落している引数の数のみを出力します。
prog.cs(10,27): error CS1501: No overload for method `createPrism' takes `2' arguments`.
ただし、デバッグの目的で、特に多くのパラメーターを受け取る関数の場合、関数呼び出しで欠落しているパラメーターの名前を取得する必要があることがよくあります。C# 関数呼び出しで欠落しているパラメーターを出力することは可能ですか?
using System;
public class Test{
public static int createPrism(int width, int height, int length, int red, int green, int blue, int alpha){
//This function should print the names of the missing parameters
//to the error console if any of its parameters are missing.
return length*width*height;
}
static void Main(){
Console.WriteLine(getVolume(length: 3, width: 3));
//I haven't figured out how to obtain the names of the missing parameters in this function call.
}
}