タグ

Tipsと例外に関するkatowのブックマーク (1)

  • エラー処理(例外処理)の基本

    Public Shared Function ReadAllText(ByVal filePath As String) As String 'ファイルを開く Dim sr As System.IO.StreamReader = System.IO.File.OpenText(filePath) '内容をすべて読み込む Dim s As String = sr.ReadToEnd() 'ファイルを閉じる sr.Close() '結果を返す Return (s) End Function public static string ReadAllText(string filePath) { //ファイルを開く System.IO.StreamReader sr = System.IO.File.OpenText(filePath); //内容をすべて読み込む string s = sr.Re

    エラー処理(例外処理)の基本
    katow
    katow 2011/04/18
    Catch ex as Exceptionしても、Throw exではなくThrowしたほうがお得(スタックトレースがクリアされない)
  • 1