Null Reference Exception when writing to an array. c# -
this question has answer here:
- what nullreferenceexception, , how fix it? 33 answers
i trying write months array in order.
string january = "january"; string february = "february"; string march = "march"; string april = "april"; string may = "may"; string june = "june"; string july = "july"; string august = "august"; string september = "september"; string october = "october"; string november = "november"; string december = "december";
and writing array so:
(int = 0; < (janc - 1); i++) { analyser.sortedmonths[i] = january; }
sortedmonths initialized in cs sheet. sorted months array 1022 in size amount of months being read in.
why not working? have googled null reference exception have not found related writing array.
analyzer.sortedmonths
null. have initialize it:
analyzer.sortedmonths = new string[12];
Comments
Post a Comment