在程式執行期間,把文字寫入output視窗是非常簡單的,只要用需要的呼叫替代console.writeline()呼叫,就可以吧文字寫到希望的地方。此時可以使用如下兩個命令:
debug.writeline() 僅在除錯模式下執行
trace.writeline() 僅在發布程式執行
debug.writeline("text 1 and i", "mytag");
命名空間:using system.diagnostics;
debug.write();
trace.write();
debug.writelineif();
trace.writelineif();
debug.writeif();
trace.writeif();1.ide的pause按鈕;
2.斷點;
3.丟擲未處理異常時進入;
4.判定語句 assertion;
try...catch...finally c#語言包含結構化異常處理(structured exception handing,seh)的語法。
try
catch(e)
finally
理解程式:
using system;
using system.collections.generic;
using system.linq;
using system.text;
namespace ch07ex02
; // padding so that line numbers match those in the chapter.
////
//static void main(string args)
\") called.", etype); // line 24
throwexception(etype);
console.writeline("main() try block continues."); // line 26
}catch (system.indexoutofrangeexception e) // line 28
\"",
e.message);
}catch // line 34
finally
console.writeline();
}console.readkey();
}static void throwexception(string exceptiontype)
\") reached.", exceptiontype); // line 49
switch (exceptiontype)
catch // line 70
finally
break;}}
}}
如果使用throw丟擲catch塊處理過的異常,那麼該異常就不會由當前try...catch...finally塊處理,而是由
上一級**處理,當前**塊的finally塊仍然會執行。
學習日記2
陣列的初始化,一維陣列和二維陣列的定義以及使用,字元陣列的定義和使用,函式的形式引數和實際引數,全域性變數和區域性變數,變數的儲存類別,預處理命令。今日任務完成情況 本日任務按照老師要求完成 今日開發中出現的問題彙總 編譯程式的出錯,演算法結構的不正確和不完整,以往的冒泡函式沒有記牢,對於陣列元素和...
C 學習日記 04 基礎運算
c 支援一下這些算術運算子 名稱 符號示例1加法 x y2減法 x y3乘法 x y4除法 x y5求餘 x y 加法 加法是從乙個數中加上另乙個數的運算,也就是求和 int x 80 8 cout x 輸出88減法 減法是從乙個數中減去另乙個數的運算 int x 88 8 cout x 輸出80乘...
java基礎學習日記(2) 求職篇
一 簡歷 必須自己寫。1 基本情況 姓名年齡等等。2 專業技能 按照企業要求技能去寫。3 求職意向 前端開發 後台開發 測試 4 工作經驗和專案經驗 必須出彩,突出自己的能力,佔據主要部分 備註 面試問題基本基於簡歷裡面的專案經驗。二 面試前的準備 針對中小型公司,bat等大型公司正常發揮即可。1 ...