I'm writing a website in ASP.NET, with C# doing all the work, but I'm fairly new to the whole Object Orientated way of thinking, so I'm having a few teething troubles.
I have an external XML file which contains all the static text for the site, with the idea that there will eventually be multiple files for different languages, and all that will need to change is a single declaration of which language to use at a high level.
I would like the XmlDocument object which accesses the file to be globally accessible by all the different functions and methods across the site.
How can I go about this? Do I have to make a new public class for all my globals, as some websites seem to suggest? I can declare the object as public in the root of a 'globals' class, using
But I don't know how to go about loading the file, since you can't use objXmlLang.Load () outside of a method. Obviously I only really need to load the document once on each page visit, so how can I do it?
(I'm not sure on a lot of the terminology and stuff, but hopefully you can understand the general idea of what I'm saying.)
I have an external XML file which contains all the static text for the site, with the idea that there will eventually be multiple files for different languages, and all that will need to change is a single declaration of which language to use at a high level.
I would like the XmlDocument object which accesses the file to be globally accessible by all the different functions and methods across the site.
How can I go about this? Do I have to make a new public class for all my globals, as some websites seem to suggest? I can declare the object as public in the root of a 'globals' class, using
Code:
public System.Xml.XmlDocument objXmlLang = new System.Xml.XmlDocument();
(I'm not sure on a lot of the terminology and stuff, but hopefully you can understand the general idea of what I'm saying.)
Comment