Answer: When we create any Class object but do not initialize with New keyword and we are dealing with that object or we are using that object anywhere in our code,then above error occurs.
For Example:-
DataTable dt_project = null;
dt_project.Columns.Add("project_id");
dt_project.Columns.Add("project_name");
In above code,we have not initialized datatable object and still adding columns to it.When we run,it will throw above error.
Asked In: Many Interviews |
Alert Moderator