is this overkill for assessing Main(string[] args)

后端 未结 5 1899
無奈伤痛
無奈伤痛 2021-01-12 06:44

I\'ve got the following and was wondering if the initial test is overkill:

static void Main(string[] args) {
    if (args.Length == 0 || args == null) {              


        
5条回答
  •  攒了一身酷
    2021-01-12 07:03

    if (args == null)
    {
        Console.WriteLine("args is null"); // Check for null array
    }
    else
    {
        if (args.Length == 0)
        {
            //do X
        }
        else 
        { 
            //do Y 
        }
    }
    

提交回复
热议问题