更新时间:2021-07-25 05:31:52
我提出了一个给出合理结果的简单解决方案,我知道format语句的参数个数,但不知道参数的类型.但是,大多数参数都是字符串.
I have come up with a simple solution that gives a reasonable result, I know the number of argument to the format statement but not the type of the arguments. However most arguments are strings.
所以
if (numberOfArguments == 3)
{
try
{
String.Format(theTranslatorString, "", "", "")
}
catch
{
// tell the translator there is a problem with the string format
}
}
当然,对于现实生活中的每个论点,在编写时都不会带有"if".
Of course this would be written without an "if" for each number of arguments in real life.