Null Reference Exception when writing to an array. c# -


this question has answer here:

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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -