c#12 C#에서 정규식(Regular Expression) 완벽 가이드 정규식(Regular Expression, Regex)은 문자열 패턴을 매칭하고 조작하는 강력한 도구입니다. C#에서는 System.Text.RegularExpressions 네임스페이스를 통해 정규식 기능을 제공하며, 문자열 검증, 추출, 치환 등 다양한 작업에 활용할 수 있습니다.정규식 기본 사용법1. Regex 클래스 기본 사용using System;using System.Text.RegularExpressions;class Program{ static void Main() { string text = "안녕하세요! 제 전화번호는 010-1234-5678입니다."; string pattern = @"\d{3}-\d{4}-\d{4}"; R.. 2025. 5. 26. C# machine key 생성하기 Visual C# .NET을 사용하여 폼 인증에서 사용할 키를 만드는 방법 http://support.microsoft.com/default.aspx?scid=312906 using System; using System.Text; using System.Security.Cryptography; namespace Crypto { public class KeyCreator { public static void Main(String[] args) { String[] commandLineArgs = System.Environment.GetCommandLineArgs(); string decryptionKey = CreateKey(System.Convert.ToInt32(commandLineArgs[1])); s.. 2011. 7. 5. C# 한글깨짐 처리 이미 사용중인 Sybase에 접근해서 내용을 가져오는데, 도무지 한글이 깨진것을 어떻게 할수가 없어서... 이렇게 확인부터 하자깨진 한글을 어떻게 제대로 표시할지 찾아보자..원본 문자열이 어떤방식의 charset으로 되어 있는지.. 어떻게 다시 제대로 표시할지 찾아보기 위해 간단한 메서드를 만들었다.[코드] public void convertCheck(string str) { Encoding encKr = Encoding.GetEncoding("euc-kr"); EncodingInfo[] encods = Encoding.GetEncodings(); Encoding destEnc = Encoding.UTF8; .. 2011. 4. 20. 자동 생성된 Machinekey 읽기 Web.Config에 따로 설정을 하면 machinekey를 읽을 필요는 없겠지만서도.. 나처럼 필요한 경우가 생길지도 몰라 구글링을 통해서 얻은 정보를 공유한다. protected void Page_Load (object sender, EventArgs e) { MachineKeySection section = (MachineKeySection) ConfigurationManager.GetSection ("system.web/machineKey"); BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty; Func propertyReader = name => (byte[]) section .. 2011. 4. 15. 실행중인 클래스명을 조회 현재 프로젝트에 있는 모든 UI 클래스 명을 얻어와 보자! 1 namespace NSCL 2 { 3 public partial class Form1 : Form 4 { 5 public Form1() 6 { 7 InitializeComponent(); 8 this.Load += new EventHandler(Form1_Load); 9 } 10 11 void Form1_Load(object sender, EventArgs e) 12 { 13 GetClassNames(); 14 } 15 16 private void GetClassNames() 17 { 18 List clsNames = new List(); 19 Assembly asm = Assembly.GetExecutingAssembly(); 20 21 f.. 2010. 10. 31. C# - Splash Screen 만들기 갑자기 생각나서 간단히 구현해 봤습니다. 스플래시 윈도우에선 아무것도 수행안하고 그냥 메세지만..보통은 필요한 데이터를 로딩한다던가, 어디다(?) 연결작업을 수행한다던가 머 그렇지요.. 아님 로고를 보여준다던가.. 우선 윈폼 프로젝트를 하나 생성하고요.. 윈도우를 두개 만듭니다.1. 메인 윈도우2. Splash 윈도우 메인 윈도우가 나타나기 전에 Splash 윈도우를 먼저 띄우고 필요한 처리가 다 되면 Splash 윈도우를 닫고메인 윈도우를 나타내게 됩니다. 소스는 머 대충 아래와 같이 program.cs \par ??\cf0 \cf5 ///\cf6 \u-10892 ?\u-19719 ? \u-14511 ?\u-14679 ? \u-11004 ?\u-18340 ?\u-21000 ?\u-18.. 2010. 8. 16. 이전 1 2 다음