project requirement [closed]
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 8 years ago.
Improve this questionin my project i have a requirement like "Set the version to something like 0.0.0.0 if the metho开发者_如何学Pythond cannot get the version from the environment variable"
and the coding where i need to look is like this array,,any one have idea about this on
string[] sade = new string[6];
.
.
.
.
sade [5] = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\secon\secservice", "CurrentVersion", "0").ToString();)
;
any one have idea about coding required here
You could do something like:
string[] sade = new string[6];
.
.
sade[5] = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\secon\secservice", "CurrentVersion", "0");
if(sade[5] == null)
{
Registry.SetValue(@"HKEY_LOCAL_MACHINE\Software\secon\secservice", "CurrentVersion", "0");
}
That will read the registry and check if it is already defined or not.
精彩评论