See line of code below:
DataTable [] _tables = null;
// Throws System.NullReferenceException
_tables.GetType();
// Throws System.ArgumentNullException
_tables.Count();
In this lines of code I have _tables
reference and trying to access its system define functions GetType()
and Count()
, both throw exception but why .Count()
throws System.ArgumentNullException
, since we have same value for reference which is null
?
ArgumentNullException
, but the reason why that practice was originally chosen. – CompanionArgumentNullException
, I never ask this question, rather search for practice and got answer for same, but while asking I wasn’t aware about that practice.. I already search for similar question but wasn’t found any one hence put this question. – Eyra