프로젝트/Color Lim 개발일지

File.WriteAllText, StreamWriter.Write

 

File.WriteAlltext는 바로가기일 뿐, 내부적으론 StreamWriter를 사용한다

 

WriteAllText

적은 텍스트를 파일에 쓰는게 전부라면 WriteAllText를 사용하기

작성할 텍스트의 양이 많을경우 큰 임시 문자열을 생성하게 되므로 좋지 않다

 

StreamWriter

파일을 열고 닫는 것처럼 파일 작성 방법을 더 제어하고 싶다면 사용하기

 

 

 

참고 자료

https://social.msdn.microsoft.com/Forums/vstudio/en-US/d4aa0fb0-0a36-4884-9fe9-30cbd51639e0/using-filewritealltext-vrs-a-streamwriter?forum=vbgeneral 

 

using File.WriteAllText vrs a StreamWriter

there isnt much difference, underneath the My.Computer.FileSystem.WriteAllText, its using the streamwriter/filestream to write to the file. It's just a method/function developed especially for VB2005. Older versions would require the use of StreamWriter to

social.msdn.microsoft.com