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;
Console.Write($"{sample.x}");
// instead do this:
SampleClass sample = new SampleClass();
Console.Write($"{sample.x}");

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 akashmittal.com