const 대 readonly 비교 using System; namespace Test { class Program { static void Main(string[] args) { Some s1 = new Some(); Console.WriteLine(Some.constField); // const : 항상 static Console.WriteLine(s1.readonlyField1); Console.WriteLine(s1.readonlyField2); Some s2 = new Some(5); Console.WriteLine(s2.readonlyField2); } } class Some { // const readonly 공통 : 클래스 밖에서 값을 바꿀 수 없음 // const : 항상 static (..
SetForegroundWindow 메쏘드를 이용한 샘플 코드이다. 1초에 한번씩 노트패드에 "abc " 스트링을 입력을 하는 것이다. using System; using System.Diagnostics; using System.Windows.Forms; using System.Runtime.InteropServices; namespace ControlHandle { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.timer1.Interval = 1000; this.timer1.Enabled = true..
Process 클래스를 이용해서 원하는 Window(Process)의 핸들값을 얻는 샘플 코드이다. using System; using System.Diagnostics; using System.Windows.Forms; namespace ControlHandle { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.textBox1.Text = String.Empty; Process[] processes = Process.GetProcessesByName("notepad"); foreach (Process ..
앞에서 보였던 GenericDictionaryXmlSerializer 클래스 2 사용 예제이다. using System; using System.Collections.Generic; using System.Xml; using GenericDictionaryXmlSerialization; namespace TestGenericDictionaryXmlSerialization { class Program { static void Main(string[] args) { Random myRandom = new Random(); Dictionary myDictionary = new Dictionary(); myDictionary["1st"] = myRandom.Next(10); myDictionary["2nd"] ..
GenericDictionaryXmlSerialization.GenericDictionaryXmlSerializer 클래스 코드입니다. 앞의 예제에서는 Deserialize mthod를 Deserialize(XmlReader reader, Dictionary dictionary) 형태로 해서 Dictionary를 파라미터로 받고 있습니다. 이런 형식은 XmlSerializer.Deserialize method와는 다른 형식이죠. 아래의 클래스는 XmlSerializer.Deserialize method와 비슷한 형식입니다. 즉 파라미터로는 XmlReader만 받고 있습니다. 그리고 Dictionary 을 반환하고 있습니다. using System; using System.Collections.Generi..
Generic Dictionary는 Xml.Serialization.XmlSerializer을 사용해서 serialize할 수 없다. 그래서 Generic Dictionary을 XML 파일로 serialize할 수 있는 GenericDictionaryXmlSerializer 클래스를 만들어 보았다. 이 클래스는 아래 링크에 있는 코드를 응용해서 만든 것이다. http://blogs.msdn.com/psheill/archive/2005/04/09/406823.aspx 위의 링크에 있는 코드는 Generic 클래스를 사용하지 않았는데, 필자의 코드는 Generic 코드를 사용한 점이 다르다. using System; using System.Collections.Generic; using System.Xml;..
Xml.Serialization 을 이용해서 DateTime 멤버를 포함하고 있는 객체의 Serialization을 시도해보았다. 결과는 만족스러웠다. 아무런 문제 없이 Serialization이 잘 이루어졌다. 아래는 예제 코드이다. 아래에서 Chrono 클래스는 string field 와 DateTime field를 가지고 있다. using System; using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; namespace SerializationTest { class Program { static void Main(string[] args) { Chrono c1 = new Chrono(); Chrono..
List 객체도 XML Serialization이 가능하다. 아래는 그 예제이다. 별로 어렵지 않은 예제이니 잘 살펴보기 바란다. using System; using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; namespace SerializationTest { class Program { static void Main(string[] args) { List myList = new List(); myList.Add("One"); myList.Add("Two"); myList.Add("Three"); XmlSerializer myXmlSerializer = new XmlSerializer(typeof(List)..
Xml.Serialization 을 사용하면 XML 형식으로 Serialization 할 수 있다. 아래 예제를 보자. 아래 예제는 string 객체를 Serialization 한 예제이다. XmlSerializer 와 XmlWriter, XmlReader 를 사용해서 Serialize & Deserialize 한다. using System; using System.Xml; using System.Xml.Serialization; namespace SerializationTest { class Program { static void Main(string[] args) { string myName = "John Dow"; using (XmlWriter writer = XmlWriter.Create("ser..
현재 실행 중인 어플리케이션과 같은 폴더에 있는 파일이나, 하위 폴더에 있는 파일의 위치를 지정하고자 한다면, Path 클래스를 사용하면 된다. 아래는 간단한 예제이다. Application.ExecutablePath 은 현재 실행 중인 어플리케이션의 위치를 반환한다. Path.GetDirectoryName 은 path에서 폴더 값만 반환한다. Path.Combine 은 두개의 path를 결합한다. using System; using System.IO; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }..
- Total
- Today
- Yesterday
- registry
- Service pack
- AdSense숨기기
- ScreenHunter
- 애드센스감추기
- 유틸리티
- 애드센스숨기기
- jre
- Regular Expressions
- DotNetMagic
- c#
- Automation
- iText
- tagREADYSTATE
- windows
- iTextSharp
- Sample Code
- Phalanger
- WinAutomation
- java
- READYSTATE_COMPLETE
- AxWebBrowser
- download.com
- autohotkey
- Microsoft
- .net framework
- Rollback Rx
- AdSense감추기
- 스크린캡쳐
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |