This question has already been answered:

Writes an error when adding an object to the "Object link does not indicate an object instance." How to be?

var countryList = new otherCountryObj(); countryList.Country = "RU"; countryList.QWE = "4000234234928305928"; model.rezidentOtherCountry.country.Add( countryList ); public class rezidentOtherCountry { public bool? isRezidentOtherCountry { get; set; } public List<otherCountryObj> country; } public class otherCountryObj { public string Country { get; set; } public string QWE{ get; set; } } 

Reported as a duplicate by Grundy , rdorn , αλεχολυτ , user194374, Bald on Dec 19 '16 at 8:16 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • one
    Do you have model.rezidentOtherCountry and model.rezidentOtherCountry.country exactly initialized? - Suvitruf

1 answer 1

In the class you need to add, for example, a constructor in the cat. initialize the collection

 public class rezidentOtherCountry { public bool? isRezidentOtherCountry { get; set; } public List<otherCountryObj> country; public rezidentOtherCountry() { country = new List<otherCountryObj>(); } }