iT邦幫忙

0

Day 6|方法與參數:把 TaskFlow 程式拆成小功能

c#
  • 分享至 

  • xImage
  •  

今日學習目標

  • 學習內容: 方法、參數、回傳值、方法拆分。
  • 今日實作: 將新增任務、顯示任務、完成任務拆成不同方法。
  • 完成標準: Main 不再包含所有功能的詳細實作,而是負責控制程式流程,其他工作交給各自的方法。

什麼是方法?

方法就像一台有特定用途的機器,只要呼叫它,它就會執行指定工作。
https://ithelp.ithome.com.tw/upload/images/20261015/20184430sw9HEL7Cm4.png

方法的參數

https://ithelp.ithome.com.tw/upload/images/20261015/20184430CztSpH3Qj9.png

回傳值

https://ithelp.ithome.com.tw/upload/images/20261015/20184430ZoACB4S6lM.png

把 TaskFlow 拆成不同方法

https://ithelp.ithome.com.tw/upload/images/20261015/201844301AE9JeYLCx.pnghttps://ithelp.ithome.com.tw/upload/images/20261015/20184430r37wrQDZ9G.pnghttps://ithelp.ithome.com.tw/upload/images/20261015/20184430JFCeOcvsI4.pnghttps://ithelp.ithome.com.tw/upload/images/20261015/201844302RvB9YG9Vs.pnghttps://ithelp.ithome.com.tw/upload/images/20261015/20184430acR5VfPFsa.png


*提醒邦友,使用第三方服務/API 時,請務必評估資安風險與隱私保護
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言