The declaration public Form1(String fileName = null) specifies one optional argument. Optional arguments are arguments that have a default value in the function. You always have the opportunity to either call a function with or without an argument, if you specify an argument, the new argument is used instead of the default argument, and if you do not specify an argument when calling the function, the default argument is used. The default value for the optinal argument should always be a value that is constant at compile time. To better clarify, let me give you an example. Consider that we have a function that adds two numbers .
private int AddNumbers(int a=10,int b=15) { int c=a+b; return c; }
We specified two optional arguments for the function, the above functions are not marked with any error, but, as I said, the optional arguments must have a default value that is known at design time, so the function below indicates the error that follows Default parameter values must be compile time constant. because it uses default values ββthat will be known at runtime.
int z,x; private int AddNumbers(int a=z,int b=x) { int c=a+b; return c; }
Note that the variables z and x are computed using some logic at runtime, but are not unknown at compile time. That would mean a mistake.
Next, let me tell you about the differences in normal function and functionality with optional parameters . The first function that compiles without errors can be called in two ways:
**By passing some arguments when calling**
AddNumbers(5,15);
This will return 20.
**By calling the function without specifying any arguments**
AddNumbers();
This will return 25, remember that we defined 10.15 as default arguments. But the calls are valid and will be compiled without errors.
So, now I hope you find the answer to your question, if you want to read more, look here.