.NET/C# Basic
-
IIS HTTPS 세팅하기 및 C# 사설 SSL 인증서 호출 사용하기 OPENSSL 사용하기.NET/C# Basic 2023. 3. 14. 14:09
1. OPEN SSL 다운로드 Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions (slproweb.com) Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions Minimum system requirements: Windows XP or later 32MB RAM 200MHz CPU 30MB hard drive space Recommended system requirements: Windows XP or later 128MB RAM 500MHz CPU 300MB hard drive space September 9, 2021 - OpenSSL 3.0 is ava..
-
C# CallerMemberNameAttribute Class 소개.NET/C# Basic 2016. 2. 29. 15:56
https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.callermembernameattribute(v=vs.110).aspx Available since 4.5 public void DoProcessing() { TraceMessage("Something happened."); } public void TraceMessage(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [Sy..
-
C# Custom Sort Null 널값이 제일 아래로 IComparer IComparable.NET/C# Basic 2013. 8. 23. 10:17
IComparable 및 IComparer 인터페이스 Visual C#에서 사용 하는 방법refer: http://support.microsoft.com/kb/320727/ko static void Main(string[] args) { // Create an arary of car objects. car[] arrayOfCars = new car[8] { new car("Ford",1992), new car("Fiat",1988), new car("Buick",1932), new car("Ford",1932), new car("Dodge",1999), new car(string.Empty,1990 ), new car("sexy",null ), new car("Honda",1977) }; // Write..
-
DLL Ressource 에서 BitmapImage 불러오기 Method.NET/C# Basic 2013. 1. 11. 00:02
1. 외부 DLL Ressource 리플렉터 => 2. 코드/// /// name : GetDllToBitmapImageResource /// desc : BitmapImage load of resource /// author : 전광식 /// create Date : 2013-01-10 오후 7:56:23 /// update date : 2013-01-10 오후 7:56:23 , 수정개요 /// /// AssemblyName /// resourceUri /// public BitmapImage GetDllToBitmapImageResource(string assemblyName, string resourceUri) { Assembly assembly = Assembly.LoadFrom(System.En..
-
Visual Studio 2005의 원격 디버깅 설정(http://www.hoonsbara.com/).NET/C# Basic 2010. 6. 14. 16:49
Visual Studio 2005의 원격 디버깅 설정 이 항목은 다음 언어에 적용됩니다. Visual Studio Edition Visual Basic C# C++ J# Web Dev Express 아니요 아니요 아니요 아니요 아니요 Standard 아니요 아니요 아니요 아니요 아니요 Pro/Team 예 예 예 예 예 Visual Studio 2005에서는 원격 디버깅을 매우 간단하게 설정할 수 있습니다. T-SQL 디버깅을 제외한 모든 원격 디버깅 시나리오에 원격 디버깅 모니터(msvsmon.exe)가 사용됩니다. 이전에 일부 디버깅 시나리오에 필요했던 Machine Debug Manager(mdm.exe)는 이제 사용되지 않습니다. 또한 msvsmon.exe에서 기존의 명령줄 인터페이스 대신 그래픽 ..
-
[C#] String.Format 을 이용한 문자정렬 왼쪽 오른쪽 가운데 | String alignment Left Right Center.NET/C# Basic 2010. 3. 20. 13:05
기초를 튼튼히 하면 삽질을 줄일수 있어요! You based foundation when the shoveling to reduce. Result : Code : static void Main(string[] args) { Console.WriteLine("123456789012345678901234567890123456789012");// 총길이 42칸 Console.WriteLine(String.Format("{0,42}", "test")); //우측정렬 Console.WriteLine(String.Format("{0,-42}", "te13123123st")); //좌측정렬 Console.WriteLine(String.Format("{0}", "1").PadLeft(42 - (21 - ("1".Len..
-
[C#] char[] + char[] = char[]?? | char[] Merge.NET/C# Basic 2010. 2. 9. 12:45
char[] c2 = { (char)0x1B, (char)0x21 }; char[] c2_2 = " 영 수 증 ".ToCharArray(); char[] c2_3 = { (char)0x1B, (char)'!', (char)0x1 }; IEnumerable ieC2 = c2.ToArray(); IEnumerable ieC2_2 = c2_2.ToArray(); IEnumerable ieC2_3 = c2_3.ToArray(); ieC2 = ieC2.Concat(ieC2_2); ieC2 = ieC2.Concat(ieC2_3); foreach (char item in ieC2) { label1.Text += item; } code of http://faram.tistory.com/ from
-
사용예) StringCollection 과 string[] int[] converterMethod.NET/C# Basic 2010. 2. 2. 12:02
StringCollection stringCollection = new StringCollection(); stringCollection.AddRange(list1.ToArray()); stringCollection.Add("|"); stringCollection.AddRange(CommonClass.ExtensionMethods.ToStringArray(list2.ToArray())); public static class ExtensionMethods { public static string[] ToStringArray(this int[] intArray) { return Array.ConvertAll(intArray, delegate(int intParameter) { return intParamet..
-
[C#] 하드시리얼넘버, 외부IP, 내부IP, DNS , NetBios, GUID 그위드 , 클릭온스 버전, 외부아이피 내부아이피 구하기 메서드.NET/C# Basic 2010. 1. 28. 11:06
public static class SystemClass { // 하드시리얼넘버 public static string GetHDDSerialNumber(string drive) { if (drive == "" || drive == null) { drive = "C"; } ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"" + drive + ":\""); disk.Get(); return disk["VolumeSerialNumber"].ToString(); } // 외부 아이피 public static string GetIP() { string tempIp = string.Empty; try { tempIp = new W..
-
C# 프로그래밍 도구.NET/C# Basic 2009. 12. 2. 11:10
http://msdn.microsoft.com/ko-kr/vcsharp/aa336818.aspx#IDEs C# 프로그래밍 도구C# 팀이 웹에서 다른 CLI 구현, 멋진 개체 브라우저, IDE 트릭, 추가 기능, Obfuscator를 비롯하여 보다 신속한 작업 수행을 지원하는 기타 유용한 도구와 유틸리티를 찾았습니다. 코드 생성 도구를 포함하여 유용한 도구, 프레임워크 및 클래스 라이브러리에 대한 추가 링크를 보려면 클래스 및 라이브러리 페이지를 확인하십시오. 주요 도구 라이브러리 및 기타 자료 C# 컴파일러 및 프레임워크 Obfuscator 디컴파일러 프로파일러/최적화 도구 리팩터링 개체 브라우저 편집기 IDE(개발 환경) 빌드 도구 표준 검증 도구 테스트 설명서 데이터베이스 정규식 그래픽, 게임 및 그..
-
내가 좋아하는 SortedList.NET/C# Basic 2009. 8. 14. 18:35
http://msdn.microsoft.com/en-us/library/ms132319.aspx#Mtps_DropDownFilterText using System; using System.Collections.Generic; public class Example { public static void Main() { // Create a new sorted list of strings, with string // keys. SortedList openWith = new SortedList(); // Add some elements to the list. There are no // duplicate keys, but some of the values are duplicates. openWith.Add("t..
-
Array.Find / List.Find Method 사용 예.NET/C# Basic 2009. 8. 7. 13:12
List.Find Method Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire List.Namespace: System.Collections.Generic Assembly: mscorlib (in mscorlib.dll) MDSN제공 신뢰할만함 (http://msdn.microsoft.com/ko-kr/library/d9hy2xwa(VS.80).aspx) C# public T Find ( Predicate match ) using System; using System.Collections.Generic; p..
-
1차원 배열(C# 프로그래밍 가이드) string 배열 스트링 배열.NET/C# Basic 2009. 2. 27. 19:56
1차원 배열(C# 프로그래밍 가이드) 다음 예제처럼 5개의 정수를 포함하는 배열을 선언할 수 있습니다. C# int[] array = new int[5]; 이 배열에는 array[0]에서 array[4]까지의 요소가 있습니다. 배열을 생성하고 배열 요소를 기본값으로 초기화하려면 new 연산자를 사용합니다. 이 예제에서는 모든 배열 요소를 0으로 초기화합니다. 같은 방법으로 문자열 요소를 저장하는 배열을 선언할 수 있습니다. 예를 들면 다음과 같습니다. C# string[] stringArray = new string[6]; 배열 초기화 선언 시 배열을 초기화할 수 있으며, 이런 경우 차수는 초기화 목록의 요소 수로 지정되므로 별도로 지정할 필요가 없습니다. 예를 들면 다음과 같습니다. C# int[] a..
-
C# 문자열 관련 Split() , subString() 관련.NET/C# Basic 2008. 11. 26. 11:53
using System; using System.Collections.Generic; using System.Text; namespace splittest { class Program { static void Main(string[] args) { string[] splitedData = {}; //짜를 떼이터를 가변 배열로 선언해야징 ㅎㅎㅎ string orignData = "나 다시|돌아갈래!|박하사탕"; string abcStr = "abcdefghijklmnopqrstuvwxyz"; splitedData = orignData.Split('|'); // 배열에 '|'을 기준으로 담는다 for (int i = 0; i < splitedData.Length; i++) { Console.WriteLine..
-
ADO.NET DB 데이터베이스 연결 Connection.NET/C# Basic 2008. 10. 28. 15:46
///////////////////////////////////// MS-SQL //////////////////////////// using System; using System.Data; using System.Data.SqlClient; class ConsoleConnection { static void Main() { SqlConnection conn = new SqlConnection(); conn.ConnectionString = "Server = KWANG-SIK\\SQL2005;database = PUBS; uid = sa ; pwd=p@ssw0rd!;"; //KWANG-SIK\\SQL2005 //Addr=KWANG-SIK\\SQL2005;Initial Catalog=PUBS //data ..
-
-
C# 프로세스( 멀티 스레드).NET/C# Basic 2008. 10. 27. 23:52
- 닷넷 프로그래밍 정복 참고 멀티스레드 스레드의 생성 스래드는 코드의 실행흐름이다 보통의 응용프로그램은 Main으로 부터 시작하는 하나의 실행 흐름을 가지며 Main의 선두에서부터 물 흐르듯이 순서대로 코드를 실행한다. 이런 방식을 싱글 스레드라고 하는데 실행 흐름이 하나밖에 없으므로 한번에 하나의 작업밖에 하지 못한다. 윈도우즈 95부터는 하나의 응용프로그램에 두개 이상의 스레드가 동시에 실핼 되루 수 있는 멀티스레드를 지원하며 닷넷도 멀티스레딩을 기본적으로 지원한다. 우리가사용하는 대부분의 응용프로그램들도 멀티스레드로 실행되고 있다. 두개 이상의 스레드를 동시에 실행할 수 있으므로 하나의 응용 프로그램이 두개의 작업을 병렬적으로 처리하는 것이 가능핟. 예를 들어 백그라운드에서 틈틈이 해야한 작업이라..
-
C# 텍스트문 입출력~! 파일열기 파일저장.NET/C# Basic 2008. 10. 27. 01:36
private void 열기ToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { Stream str = openFileDialog1.OpenFile(); StreamReader reader = new StreamReader(str); textBox1.Text= reader.ReadToEnd(); reader.Close(); this.Text = openFileDialog1.FileName; } } private void 저장ToolStripMenuItem_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDi..
-
C# 커스텀 어트리뷰트 전처리문.NET/C# Basic 2008. 10. 17. 04:46
/////////// 커스텀어트리뷰트 //////////////// 사용자가 직접 정의하는 어트리뷰트를 커스텀어트리뷰트라고 한다. 컴파일 방식이나 생성되는 기계어 코드에는 전혀 영향을 주지 않으며 실행 파일에 메타 데이터로 포함될 뿐이다 코드에 설명을 다는 일종의 주석이라고 할 수 있는데 자유롭게 붙이는 문자열 형태의 주석과는 달리 일정한 형식이 있으며 프로그래밍 방식으로 조작할 수 있으므로 자동화된 처리가 가능하다는 점이 다르다 커스텀 어트리뷰트를 어떻게 정의해서 어디다 사용할 것인가느 그야말로 사용자 마음대로이다 컴파일러는 어트리뷰트의 형식을 체크하여 제대로 작성했는지 점검하고메타 데이터로 기록만 해놓을뿐 이 데이터를 읽어서 사용하는 주체는 사용자이다 다음 예제는 메서드와 필드에 제작자와 작성시기를 ..
-
C# 어트리뷰트 예외처리.NET/C# Basic 2008. 10. 16. 16:27
//////////////////// 어트리뷰트 //////////////// C#문법은 지정자로 각 요소의 성질을 밝힌다. public private 지정자는 맴버의 공개 여부를 통제하며, const, readonly는 변경가능성을 지정하고static abstract 는 기억장소나 구현여부를 결정한다 지정자별로 의미가 정해져 있어서 문법 요소에 다양한 성질을 부여할 수 있다 문법이 지원하는 것 이외의 성질을 더 지정하고 싶을 떄는 이 절에서 소개하는 어트리뷰트를 사용한다 어트리뷰트는 컴파일러에게 코드에 대한 여분의 추가 정보를 제공하는 선언 형식이다 이렇게 추가된 정보는 컴파일 방식에 영향을 주기도 하며 공식적이고 간결한 형태로 코드를 문서화하기도 한다 어트리뷰트 형태로 작성된 기록은 실행파일에 포함되..
-
C# 켈렉션 콜렉션 ArrayList Hashtable SortedList Stack.NET/C# Basic 2008. 10. 16. 15:05
ArrayList 클래스 IList 인터페이스를 구현한 것으로, 객체 배열의 크기가 동적으로 조절 내부적으로는 object형 배열을 가지며, 배열의 크기가 할당된 것보다 더 필요한 경우 더 큰 배열로 대체 using System; using System.Collections; class Class { static void Main() { ArrayList list = new ArrayList(); list.AddRange(new string[] {"apple","bababobo","cat" }); list.Sort(); foreach(string s in list) Console.WriteLine(s); Console.WriteLine(list[2]); } } Hashtable 클래스 Hashtable ..
-
닷넷 클래스 object is 연산자 GetHashCode().NET/C# Basic 2008. 10. 16. 00:42
닷넷 클래스 object object도 일종의 클래스 이므로 내부에 맴버를 가진다 생성자는 아무것도 하지않는 디폴트생성자만 정의되어있으면 필드, 상수, 프로퍼티 인덱서 이벤트등은 가지지않는다.루트 클래스의 맴버는 모든 후손에게 상속되므로 메모리를 소모하는 멤버는 포항하기 어렵다 만약 object에 40바이트의 필드가 있다면 닷넷의 모든 객체는 최소 40바이트 이상으로 되어야하므로 메모리 낭비가 너무 심해질것이다 그래서 객체를 관리하는 일반적인 메서드만을 가진 object 로부터 파생된 모든클래스의 객체들은 이메서드를 가지는 셈이다 ToString public virtual 객체를 문자열 형태로 표현한다 티폴트로 클래스 이름을 리턴하는 데 필요시 재정의할수있다 GetType public 객체의 타입정보를 ..
-
닷넷 클래스 리플렉션 reflection.NET/C# Basic 2008. 10. 15. 18:00
클래스 라이브러리 닷넷 기본 클래스 라이브러리를 사용하면 개발 시간을 많이 단축할 수 있다 제공된 클래스를 생성하거나 상속받아서 새로운 클래스를 정의 System 네임스페이스는 기본 클래스를 모아둔 네임스페이스 System.Object 객체를 비롯해서 기본 데이터형과 같은 기본 클래스가 정의 리플렉션 GetType 메서드는 클래스를 나타내는 Type 객체를 리턴하는 메서드 Type 객체를 이용하면 실행 타임에 클래스에 대한 다양한 정보를 구할 수 있다 Type type = pt.GetType(); FieldInfo [] finfo = type.GetFields(); Type 객체로부터 클래스 정보를 구할 수 있는 방법을 리플렉션(reflection) 이라 한다 리플렉션을 통해서 알아낼 수 있는 정보에는 ..
-
클래스관련 const 상수 readonly 구조체관련 GetType() , is as.NET/C# Basic 2008. 10. 15. 14:48
using System; class Sizes { public const int Medium = 100; // 상수로써 사용되는것 const 항상동일한수 public const int Large = 105;// const 라고 붙은것은 별도의 객체생성없이도 가능 public const int XLarge = 110; } class Shirt { public static void Main() { while(true) { string s; Console.WriteLine("치수 기호를 입력하세요. (M)edium (L)arge (X)Large (q)uit"); s = Console.ReadLine(); if(s == "q") break; switch(s) { case "M" : Console.WriteLin..
-
프로퍼티 인덱서.NET/C# Basic 2008. 10. 15. 06:11
///// 프로퍼티 ///////// using System; class test { private int a; public int A { get { Console.Write("get"); this.a = a+2; return a; } set { Console.WriteLine("set"); this.a = value; } } } class jks { static void Main() { test t = new test(); t.A = 2; Console.WriteLine("{0}",t.A); } } using System; class jksPro { private string Name; public string NameP { get { string newName = this.Name + "추가문장"; ..
-
연산자 메서드 operator +(), operator-() , 연산자 오버로딩?.NET/C# Basic 2008. 10. 15. 05:37
연산자 메서드를 부르려면 해당 연산자를 사용하며, 연산자를 사용하면 코드가 훨씬 직관적이기 때문에 이해하기 쉬워진다 using System; class Point { public int x; public int y; public Point( int x, int y ) { this.x = x; this.y = y; } public override string ToString() { // (x,y) 값 return String.Format("({0},{1})", x, y ); } // + 연산자 메서드 public static Point operator +(Point pt1, Point pt2) { return (new Point(pt1.x + pt2.x, pt1.y + pt2.y)); } // - 연산자 ..
-
static정적맴버 배열 연산자 is/as foreach 문 메서드 오버로딩 메서드 가변 인자.NET/C# Basic 2008. 10. 14. 21:41
정적(static) 멤버 일반적인 객체 사용 방법은 클래스를 정의하고, 여러 개의 인스턴스를 생성 현재 생성된 총 인스턴스 수를 구하려면 정수형 변수를 두고 인스턴스를 생성할 때마다 하나씩 증가 인스턴스간에 공유해야 하는 값이 필요한 경우, 정적(static) 멤버를 사용 using System; class Point { public Point() { bbb++; Console.WriteLine("생성"+ bbb); } public int bbb = 0; // static int bbb = 0;v // 스택틱하면 값이 더해진다 } class jks { static void Main() { Point pt = new Point(); Point pt1 = new Point(); } } 배열////// usi..