C#

    [C#] 파일 및 폴더 이동

    자주 사용하게 되는 코드 // Simple synchronous file move operations with no user interface. public class SimpleFileMove { static void Main() { string sourceFile = @"C:\Users\Public\public\test.txt"; string destinationFile = @"C:\Users\Public\private\test.txt"; // To move a file or folder to a new location: System.IO.File.Move(sourceFile, destinationFile); // To move an entire directory. To programmatically..

    [C#] 파일 및 폴더 삭제

    자주 사용하게 되는 코드 // Simple synchronous file deletion operations with no user interface. // To run this sample, create the following files on your drive: // C:\Users\Public\DeleteTest\test1.txt // C:\Users\Public\DeleteTest\test2.txt // C:\Users\Public\DeleteTest\SubDir\test2.txt public class SimpleFileDelete { static void Main() { // Delete a file by using File class static method... if(System.IO.F..

    [C#] 파일 및 폴더 복사

    파일 및 디렉터리 복사 방법 자주 사용하는 코드라 저장용. // Simple synchronous file copy operations with no user interface. // To run this sample, first create the following directories and files: // C:\Users\Public\TestFolder // C:\Users\Public\TestFolder\test.txt // C:\Users\Public\TestFolder\SubDir\test.txt public class SimpleFileCopy { static void Main() { string fileName = "test.txt"; string sourcePath = @"C:\User..

    [C#] 현재 실행되는 실행 파일의 경로 얻기

    실행 파일의 경로가 필요한 경우가 종종 발생한다. Application.ExecutablePath 위 속성을 이용하면 실행 파일 경로를 쉽게 얻을 수 있다. string sExecutableFolder = Application.ExecutablePath; int n = sExecutableFolder.LastIndexOf(@"\"); sExecutableFolder.Substring(0, n+1); 이렇게 하면 실행 파일이 존재하는 Folder 경로를 얻을 수도 있게 된다.

    [C#] 속도 측정용 간단 코드

    using System.Diagnostics; Stopwatch sw = new Stopwatch(); sw.Start(); RenderScene(); sw.Stop(); Console.WriteLine(sw.Elapsed.ToString()); 간단하게 처리 가능.