My question is that why we need to check for null error in string[]. isn't it that string type can accept the null value by default? so why we should check that if string [] contains null by using Null conditional operator token(?).
for Example look at this method:
it's from the book C# and NetFramework 4.6
static void TesterMethod(string[] args)
{
// We should check for null before accessing the array data!
Console.WriteLine($"You sent me {args?.Length} arguments.");
}
I mean if we can assign null to a string why we should check for the null error? why should this throw an error?
Console.WriteLine($"You sent me {args.Length} arguments.");