기본 콘텐츠로 건너뛰기

글

라벨이 c#인 게시물 표시

c# throw exception example

class ProgramLog { System.IO.FileStream logFile = null ; void OpenLog(System.IO.FileInfo fileName, System.IO.FileMode mode) {} void WriteLog() { if (! this .logFile.CanWrite) { throw new System.InvalidOperationException( "Logfile cannot be read-only" ); } // Else write data to the log and return. } } https://msdn.microsoft.com/ko-kr/library/ms173163.aspx 내 코드 throw new System.InvalidOperationException("필드의 갯수가 맞지 않아 파일을 무시 합니다.");