Windows Form Application의 path를 구하는 방법은 간단하다. Application.ExecutablePath 를 사용하면 된다. 아래는 사용 예제이다. using System; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.textBox1.Text = Application.ExecutablePath; } } }
아래는 실행중인 어플리케이션의 현재 위치를 구하는 간단한 예제이다. 이 예제는 System.Reflection 을 사용했다. Assembly.GetExecutingAssembly() 은 현재의 Assembly를 반환한다. Location Property는 Assembly의 위치를 반환한다. using System; using System.Reflection; namespace Test { class Program { static void Main(string[] args) { string myPath = Assembly.GetExecutingAssembly().Location; Console.WriteLine(myPath); Console.Read(); } } }
BinaryFormatter.Serialize 와 BinaryFormatter.Deserialize 를 사용한 예제입니다. 아래 예제를 보면 [Serializable] Attribute를 사용한 Name 클래스만 Serialize & Deserialize 한 것을 알 수 있습니다. 이 예제는 사실 BinaryFormatter.Serialize & BinaryFormatter.Deserialize 의 버그 여부를 조사하기 위해서 만들었습니다. Serialize 후 일부 데이터를 변경하고, 다시 Deserialize 했을 때, 혹시 버그가 있나 검사해봤는데, 정상이었습니다. BinaryFormatter.Serialize & BinaryFormatter.Deserialize 는 generic static me..
SHIFT + ALT + F10 : Open Drop-Down Menu SHIFT + ALT + Q : Open Drop-Down Menu for Visual Assist X CTRL + ` : Open Drop-Down Menu for DevExpress Refactor! SHIFT + ALT + ENTER : Full Screen F7 : Code View SHIFT + F7 : Design View CTRL + K, X : Edit.InsertSnippet CTRL + K, S : Edit.SurroundWith CTRL + K, W : Edit.CompleteWord (or CTRL + SPACE) CTRL + K, I : Edit.QuickInfo CTRL + K, L : Edit.ListMem..
Generic Method 를 사용하면 상당히 유용한 Serialization 을 구사할 수 있다. 아래 예제는 Generic Method 를 사용하여 어떠한 Type이라도 쉽게 Serialize & Deserialize 할 수 있도록 한 것이다. 이런 것들은 실전에서 유용하게 이용될 수 있다. using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; namespace GenericSerializer { public static class Serializer { public static void Export(string otherFile, T otherT) { using (Stream s = File.Open(..
객체를 serialize 하여 파일에 저장하는 방법은 아래와 같다. serialize 하려는 클래스에 [Serializable] Attribute 를 붙인다. Stream 으로 serialize 파일을 연다. BinaryFormatter.Serialize 로 serialize 된 객체를 파일에 저장한다. BinaryFormatter.Deserialize 를 사용하면 serialize 되어 파일에 저장된 객체를 불러올 수 있다. 아래 예제를 살펴보자. using System; using System.IO; using System.Runtime.Serialization.Formatters.Binary; namespace SerializableAttribute0001 { class Program { stati..
DataGridView 사용에 대한 간단한 예제이다. DataGridView.ColumnCount 를 사용해서 열의 갯수를 정한다. DataGridView.Columns[].Name 으로 각 열의 이름을 정한다. DataGridView.Rows.Add() 를 이용해서 행을 추가한다. using System; using System.Windows.Forms; namespace DataGridViewSample { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.dataGridView1.ColumnCount ..
C#과 .NET을 공부하다 보면 Base Class Library에 정말 별의별것들이 다 있다는 생각을 하게 된다. 프로그램을 만들기 위해서 특별히 다른 라이브러리를 구할 필요가 거의 없을 지경이다. 문제는 도대체 어떤 것들이 있는지를 파악하기 어렵다는 것이다. 너무 많기 때문이다. C# 문법 자체에 대한 공부도 중요하지만, BCL 안에 어떤 것들이 있는지 아는 것도 중요할 것이다. BCL에 대해서 정리해 놓은 책을 하나 구해봐야겠다. 찜해 놓은 것이 하나 있긴 하다. Programming Microsoft Visual C# 2005: The Base Class Library (Pro-Developer) by Francesco Balena (Paperback - May 10, 2006) Publisher..
단위는 헷갈리기 쉬운데, 아래 표에 정리되어 있다. 참고하기 바란다.
두 시간 사이의 간격을 계산하기 위해서 DateTime 과 TimeSpan 을 사용할 수 있다. DateTime 은 측정하려는 두 시간을 구할 때 사용한다. TimeSpan 은 두 시간 사이의 간격을 계산할 때 사용한다. 아래 예제를 보자. using System; using System.Threading; namespace ThreadTest { class Program { static void Main(string[] args) { int result; int signature; TimeSpan oneSecond = TimeSpan.FromSeconds(1); Console.WriteLine(oneSecond); for (int i = 0; i < 10; i++) { DateTime old = Dat..
- Total
- Today
- Yesterday
- WinAutomation
- iTextSharp
- jre
- Automation
- 애드센스숨기기
- Service pack
- 유틸리티
- 애드센스감추기
- Microsoft
- tagREADYSTATE
- autohotkey
- Rollback Rx
- Phalanger
- registry
- Regular Expressions
- java
- Sample Code
- AdSense숨기기
- ScreenHunter
- c#
- AdSense감추기
- AxWebBrowser
- DotNetMagic
- iText
- .net framework
- download.com
- windows
- READYSTATE_COMPLETE
- 스크린캡쳐
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |