1
Answer

C# Beginner Question (Passing NULL string to function)

kastion

kastion

16y
2.6k
1
I'm running a function where there's two strings being passed. Under some circumstances the second string may be NULL, what I'm wondering is will C# give warnings/errors for passing null values in this manenr? Can I essentially do something like this:

 private Boolean MyFunction(String _ParamOne, String _ParamTwo)
{
    if (_ParamTwo == null)
    {
        run_myfunction();
        doThis(_ParamOne);
        return false;
    } else {
        run_myfunction();
        doThat(_ParamOne, _ParamTwo);
        return false;
    }  
}

On the same note does anyone know any good resources where I can search for information on things like this as well as syntax, system functions and what-not? I've been programming for quite some time but I'm new to C# and still getting a feel for it. Thanks.

Answers (1)