본문 바로가기

반응형
   

전체 글

(1624)
Generic, var 자료형태, Sample delegate, Partial using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Work { class Work { static void Main(string[] args) { //제네릭(Generic) // - 내부 구조나 알고리즘이 동일하되 다루는 자료형만 다른 경우 클래스나 메서드를 간결화 시키는 기법 // - 컴파일될때 자료형이 결정 WrapperInt n1 = new WrapperInt(10); Console.WriteLine("int형:{0}", n1.Value); WrapperString s1 = new WrapperString("문장"); Console.WriteLine("String형:{0}", s..
주소록 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Collections; namespace ConsoleEx { class MiniProject { //address.dat의 복사본(읽기용) private static ArrayList list; static void Main(string[] args) { //1. 주소 입력하기 //2. 주소록 보기 //3. 검색하기 //4. 종료 //address.dat의 내용을 ArrayList(list)에 전체 복사 list = new ArrayList(); LoadData(); //메뉴 bool loop = ..
ArrayList, Queue 구현 //2012-2-24 받은 문제 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace ConsoleEx { class q2_24_al { //398기 모두 다함께 취업합시다!!!!!! static void Main(string[] args) { UAL a = new UAL(); Console.WriteLine(a.Count); Console.WriteLine(a.Capacity); a.Add(10); a.TrimToSize(); a.Add(10); a.Add(10); Console.WriteLine(a.Count); Console.WriteL..
스트림, 인코딩 스트림(Stream) - 파일 읽기, 쓰기 : 텍스트 파일 - 프로그램을 기준으로 내부에서 외부, 외부에서 내부로 데이터가 이동될때 데이터의 단위 - 데이터 흐름 - C#에서의 모든 입출력 단위 인코딩 - 문자 코드를 0과 1의 바이너리값을 가지는 연속된 비트 형태로 매핑시키는 작업 - 디코딩 : 인코딩 반대작업, 복원화 - ASCII : 7비트 사용, 총 128문자 표현 - ISO-8859-1 : 8비트 사용, 서유럽 문자 집합, 총 256문자 표현 - KS C 5601 : 한국 공업 표준, 2바이트 완성형 한글 표현, ASCII 제외 - EUC-KR : ASCII 문자코드 1바이트, 한글 2바이트 - Unicode : 2바이트 문자 코드 체계 - UTF-8 : ASCII 문자코드 1바이트, 다른 문자..
파일 & 디렉토리 파일 & 디렉토리 - 파일 및 디렉토리 조작 클래스 - System.Id 네임스페이스 - FileSystemInfo 클래스 파생 - 파일 : FileInfo 클래스 - 디렉토리 : DirectoryInfo 클래스 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO;// InputOutput namespace ConsoleEx { class Ex115_FileInfo { static void Main(string[] args) { //M1(); //M2(); //M3(); //M4(); M5(); } private static void M5() { //이름 바꾸기 FileInf..
예외처리(Exception) 예외처리(Exception Handing) -예외(Exception) : 예상하지 못했던 상황 - 형변환 - 파일처리 - DB처리 등.. 예외 클래스(객체) -System.Exception : 루트 클래스 -일반적으로 "예외명" + "Exception" -입출력 예외 : IOEXception -배열 인덱스 예외 : IndexOutOfRangeException -오버플로우 예외 : OverflowException try-catch 문 - 발생하는 예외를 처리하는 구문 - try : 예외가 발생하는 구문을 - csatch : 예외 발생 시 처리하는 구문을 갖는다. using System; using System.Collections.Generic; using System.Linq; using System.T..
컬렉션(Collection) 컬렉션 - 데이터 집합 - 배열 (단일 데이터형 집합), 컬렉션(단일, 다중 데이터형 집합) - ArrayList - HashTable - Queue - Stack - 동적으로 메모리 확장 - 내부 수정, 삭제, 검색 등 기능 제공 using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace Test { class ArrayList01 { static void Main(string[] args) { //배열 -> 크기가 불변(고정) //컬렉션 -> 크기가 가변 배열 int[] ns = new int[3]; ns[0] = 34; ns[1] = 34; ..
프로퍼티(Properti), 인덱서(indexer) using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Test { class Property01 { static void Main(string[] args) { Test t1 = new Test(10); Console.WriteLine(t1.GetN()); Console.WriteLine(t1.ToString()); t1.SetN(20); Console.WriteLine(t1.GetN()); //t1.n = 30; //Console.WriteLine(t1.n); // t1.N = 300; Console.WriteLine(t1.N); } } class Test { //1~100 캡슐화 pr..

반응형