.NET & WPF 2007/09/28 19:31
C# 레지스트리에 값을 쓰고, 읽고, 삭제하기
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32; // 레지스트리관련 클래스를 쓰기위해서 추가
namespace regiEx1
{
class Program
{
static void Main(string[] args)
{
string regSubkey = "Software\\myTestKey";
// 서브키를 얻어온다. 없으면 null
RegistryKey rk = Registry.LocalMachine.OpenSubKey(regSubkey, true);
// 없으면 서브키를 만든다.
if (rk == null)
{
// 해당이름으로 서브키 생성
rk = Registry.LocalMachine.CreateSubKey(regSubkey);
}
string[] strData = new string[] {"aaa","bbb","ccc"};
// 서브키 아래 값 쓰기
rk.SetValue("test", strData);
// 서브키 아래 값 읽기
string[] regStr = rk.GetValue("test") as string[];
Console.WriteLine(regStr[1]);
Console.ReadLine();
// 서브키 삭제
Registry.LocalMachine.DeleteSubKey(regSubkey);
}
}
}
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32; // 레지스트리관련 클래스를 쓰기위해서 추가
namespace regiEx1
{
class Program
{
static void Main(string[] args)
{
string regSubkey = "Software\\myTestKey";
// 서브키를 얻어온다. 없으면 null
RegistryKey rk = Registry.LocalMachine.OpenSubKey(regSubkey, true);
// 없으면 서브키를 만든다.
if (rk == null)
{
// 해당이름으로 서브키 생성
rk = Registry.LocalMachine.CreateSubKey(regSubkey);
}
string[] strData = new string[] {"aaa","bbb","ccc"};
// 서브키 아래 값 쓰기
rk.SetValue("test", strData);
// 서브키 아래 값 읽기
string[] regStr = rk.GetValue("test") as string[];
Console.WriteLine(regStr[1]);
Console.ReadLine();
// 서브키 삭제
Registry.LocalMachine.DeleteSubKey(regSubkey);
}
}
}





댓글
2008/05/23 04:36
너는 위치를차가운 만들었다!
2008/05/23 04:55
나는 합의한다 너에 이다. 그것은 이렇게 이다.
2008/05/23 05:38
좋은 위치는 찾아본 그것 즐겼다!
2008/05/23 06:03
우수한과 아주 도움이 되는!
2008/05/23 07:14
그런 위치를 경이롭 위해 많게의 감사!
2008/05/23 07:38
걸출한 위치! 많은 감사.
2008/05/24 00:49
걸출한 블로그!
2008/05/24 00:49
좋은 너를 위치! 감사하십시요.
2008/05/24 00:55
너는 위치가 우수한 있는다!
2008/05/24 01:06
우수한과 아주 도움이 되는!
2008/05/24 03:49
나는 배웠다 매우…
2008/05/24 04:07
여기 ì´ê²ƒì€ 뉴스 있다!