Determining if a parameter uses “params” using reflection in C#?

前端 未结 3 494
时光取名叫无心
时光取名叫无心 2021-01-17 07:47

Consider this method signature:

public static void WriteLine(string input, params object[] myObjects)
{
    // Do stuff.
}

How can I determ

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-17 08:24

    Check for the existence of [ParamArrayAttribute] on it.

    The parameter with params will always be the last parameter.

提交回复
热议问题