본문 바로가기

C#70

FileSystemWatcher를 이용한 파일 변경 및 생성 감시 간단한 예제!! 예제가 성의없어 죄송합니다 -_-;; FileSystemWatcher fswTEST = null; private void ViewerFrm_Load(object sender, EventArgs e) { InitControl(); EventHandler(); } private void InitControl() { fswTEST = new FileSystemWatcher(); // 파일을 감시할 경로 설정 fswTEST.Path = Path.GetPathRoot(Environment.SystemDirectory) + "watchFolder"; // txt 파일의 확장자만 검색 fswTEST.Filter = "*.txt"; } private void EventHandler() { //이벤트 핸들러 설정 fsw.. 2015. 12. 18.
enum Flags Attribute static void Main() { PipeDirection d = PipeDirection.B | PipeDirection.C; Console.WriteLine(d); Console.WriteLine((int)d); } [Flags] public enum PipeDirection : uint { A = 0x01, B = 0x02, C = 0x04 } 16진수 B와 C를 더하면 6 결과는 B,C 6 Flags 를 주석 처리 하면 결과는 6 6 이 나옵니다 ;; 전 아직 정확히 이해를 못한상태입니다=0=;; 2015. 12. 1.
Entity Framework ExecuteStoreQuery 를 이용하여 쿼리문이나 함수 실행 간단 예제 역시나 예제가 너무 성의 없어 죄송합니다 ;;; var result= Db.ExecuteStoreQuery("SELECT * FROM dbo.UFN_ProductList (@Param)" , new System.Data.SqlClient.SqlParameter { ParameterName = " Param", Value = " Parameter"}) 쿼리문에는 @Param 변수를 명시하고 SqlParameter를 이용해 Value 설정 2015. 11. 3.
C# 퍼센트 구하기 간단한 예제 decimal a = 2000; int prdcqty = 1000; Console.WriteLine((prdcqty / (float)a) * 100); // 결과 50 형편 없는 예제라 죄송합니다 ;; 2015. 9. 15.