제목이 말하는대로 아래 시나리오 중 어느 것이 더 빠릅니까?파일보다 FileInfo.Exists/Copy가 더 빠릅니까?
// Using FileInfo
FileInfo file = new FileInfo(@"C:\Test.txt");
if (file.Exists)
file.CopyTo(@"C:\TestCopy.txt");
// Using File
if (File.Exists(@"C:\Test.txt"))
File.Copy(@"C:\Test.txt", @"C:\TestCopy.txt");
FileInfo는 눈이 읽기 쉽지만 다른 방법보다 빠릅니다.
사례에 대한 벤치 마크를 작성하려 했습니까? – Romoku
작은 테스트를 작성하고 결과를 공유하십시오. – Mzf
참조 : http://stackoverflow.com/questions/1324788/what-is-the-difference-between-file-and-fileinfo-in-c. YMMV를 사용하고 있으며 정확한 사용 사례에 따라 달라 지므로 다른 사람들이 제안한 벤치 마크를 수행하는 것이 가장 좋은 방법 일 것입니다. –