Check out example codes for "object reference not set to an instance of an object c#". It will help you in understanding the concepts better.

Code Example 1

long[][] array = new long[1][];
array[0][0] = 3; // is null because only the first dimension is yet initialized.
                 // Use array[0] = new long[2]; first.

Code Example 2

SampleClass sample;
// instead do this:
SampleClass sample = new SampleClass();

Code Example 3

Dictionary<string, int> agesForNames = null;
int age = agesForNames["Bob"]; // agesForNames is null.
                               // There is no Dictionary to perform the lookup.

Learn ReactJs, React Native from