C# custom class array error in adding a new entry.

[System.Serializable]
public class ButtonPair
{
public int AnsButton;
public string SelectButton;
}

        Public Class MyClass : MonoBehaviour
        {
        ButtonPair[] ButtonPairs = new ButtonPair[4];
        
        ButtonPairs[1].AnsButton = 10;
        ButtonPairs[1].SelectButton = "test";
        }

I have this code above and it is giving me a NullReferenceException error.
Please help. I am new to this class array.

Never mind. I found the answer in Question of @Common_Horse which is very similar to this. Kudos Unity Answer Citizens.

[System.Serializable]
         public class ButtonPair
         {
               public int AnsButton;
               public string SelectButton;
         }
     
         Public Class MyClass : MonoBehaviour
         {
         ButtonPair[] ButtonPairs = new ButtonPair[4];

         ButtonPairs[1] = new ButtonPair(); //I inserted this line to solve the error
         ButtonPairs[1].AnsButton = 10;
         ButtonPairs[1].SelectButton = "test";
         }