C#C
C#16mo ago
Merineth

✅ Passing a potential NULL value, is it allowed?

namespace Calculator.Controller
{
    internal class CalculatorController
    {

        public static void Run(string[] input)
        {
            if (input == null)
            {
                InputHandler.zeroinputargument(input);
            }
            else
            {
                InputHandler.twoinputarguments(input);
            }
        }
    }
}

namespace Calculator.View
{
    public class InputHandler
    {
        // These two methods are used to determine if the array of input had 
        public static void zeroinputargument(string[] input)
        {
            
        }
        public static void twoinputarguments(string[] input) 
        { 
            
        }
    }
}

Would this be valid even if the input argument for InputHandler.zeroinputargument(input); and InputHandler.twoinputarguments(input); might be NULL?
Was this page helpful?