hey guys, im still learning to code in C# im enjoying it i must say but i find it confusing sometimes!
I was wondering how i would go about storing a string, basicly, when my program loads, (single form) it does a series of OS registry checks. now, some parts of my application requite the results for several things, but i dont want to have the actual "checks" run every time its needed, how can i make it run once then store the value for later use?
Here is one of the checks i run, a check to see if its a 64 or 32bit OS. can i have this run once and store its resault and reuse it?
Thanks!
I was wondering how i would go about storing a string, basicly, when my program loads, (single form) it does a series of OS registry checks. now, some parts of my application requite the results for several things, but i dont want to have the actual "checks" run every time its needed, how can i make it run once then store the value for later use?
Here is one of the checks i run, a check to see if its a 64 or 32bit OS. can i have this run once and store its resault and reuse it?
Thanks!
Code:
private static bool is64BitOperatingSystem()
{
RegistryKey localEnvironment = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment");
String processorArchitecture = (String)localEnvironment.GetValue("PROCESSOR_ARCHITECTURE");
if (processorArchitecture.Equals("x86"))
{
return false;
}
else
{
return true;
}
}
Comment