[Mono-list] Reference problem or misunderstanding
robertj at gmx.net
Sat Sep 9 18:18:31 EDT 2006
Rob Brown-Bayliss wrote:
> Hi, I am getting a null reference error when trying to set a value in Gconf.
> But I am sure the problem is my misunderstanding of the way c# handles
> classes etc.
> I have a Prefs class which deals with GConf.
> in my main app class I have the following:
> public Prefs prefs;
> public MainWindow (): base ("")
> Stetic.Gui.Build (this, typeof(MainWindow));
> Prefs prefs = new Prefs();
Prefs prefs = new Prefs() is hiding the outer "prefs" field defined
at class scope. Try this:
this.prefs = new Prefs();
More information about the Mono-list