Using C#'s XML comment cref attribute with params syntax

前端 未结 3 1453
粉色の甜心
粉色の甜心 2020-12-24 08:58

In C#, I am trying to use to reference a method signature that contains the params keyword. I know this converts the parameter list to an array,

3条回答
  •  悲&欢浪女
    2020-12-24 09:08

    You just leave out the param keyword and put in the type like this:

    /// 
    /// 
    /// 
    public static void Main()
    {
        Method("String1", "String2");
    }
    
    public static void Method(params string[] values)
    {
        foreach (string value in values)
        {
            Console.WriteLine(value);
        }
    }
    

提交回复
热议问题