Use if statement to check command line parameter count - CSharp Language Basics

CSharp examples for Language Basics:if

Description

Use if statement to check command line parameter count

Demo Code

using System;//from   w  ww .  j a v  a2 s  .c  o m
using static System.Console;
using System.IO;
class Program
{
   static void Main(string[] args)
   {
      if (args.Length == 0)
      {
         WriteLine("There are no arguments.");
      }
      else
      {
         WriteLine("There is at least one argument.");
      }
   }
}

Result


Related Tutorials