On Thu, Feb 26, 2009 at 5:44 PM, Dave Null <[email protected]> wrote: > I'm trying to use the IDeserializationCallback interface with Mono 2.2 on > OS X 1.5.6 : > > [snip] > > [NonSerialized] private int[] tab; > public virtual void OnDeserialization(Object sender) { > for (int i = 0; i < limite; i++) { > tab[i] = i + 42; > } > } > > [snip] > > This code compile fine with gmcs but execution throws an > System.NullReferenceException :
NonSerialized members are initialized to the default value for that type, which is null for reference types like arrays. So you can't assign anything to tab[i] until you create the array. It looks like you are missing "tab = new int[limite];". -- Chris Howie http://www.chrishowie.com http://en.wikipedia.org/wiki/User:Crazycomputers _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
