开发者

project requirement [closed]

开发者 https://www.devze.com 2022-12-14 23:15 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

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 question

in 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号