1 / 3

C# たん

null 非許容系の API. 前提 : 持ってないユニット・ゲーム中に存在しないユニットの詳細画面は開きようがない。. C# たん. 元データも非 null. SelectedUnitId = 1001;. 表示側も非 null. void ShowUnitDetail( int unitId) { … } void ShowUnitDetail( Unit unit) { if (unit == null ) new ArgumentNullException (); … }. 必殺技. null を渡されたらエラーにする.

brone
Télécharger la présentation

C# たん

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. null非許容系のAPI 前提: 持ってないユニット・ゲーム中に存在しないユニットの詳細画面は開きようがない。 C#たん 元データも非null SelectedUnitId = 1001; 表示側も非null void ShowUnitDetail(int unitId) { … } void ShowUnitDetail(Unit unit) { if (unit == null) newArgumentNullException(); … } 必殺技 nullを渡されたらエラーにする  明けの明星 Lv.9 HP 999 MP 572 攻撃力 683 素早さ 120 リリース前のテストで エラーが出なくなるまでデバッグ Lv.80 Exp 621,857 次まで6,302 予期せぬエラー ユニットが見つかりません

  2. null非許容系のAPI 必殺技 HP MP 攻撃力 素早さ Lv. Exp 次まで リリース前のテストで エラーが出なくなるまでデバッグ 予期せぬエラー ユニットが見つかりません

  3. null伝搬系のAPI 前提:空のスロットが存在しうる。空スロットにはnullを入れておく。 Team = newTeam { {1001, { 2001, 3001 } }, {2052, { null, 2231 } }, null, {3123, null }, }; チーム編成 コスト チーム1 54/75 ユニットをセットしていない空きスロットにはnullを指定する コスト10+20 HP 999 +200 MP 572 +94 攻撃力 683 +108 素早さ 120 +32 表示側もnullを受け付け void ShowUnitThumbnail(int? unitId) { … } void ShowUnitThumbnail(Unit unit) { if (unit == null) // [追加]アイコンを表示 else // ユニットのアイコンを表示 } 空きスロット(ユニットがnull)の時は[追加]アイコンを表示

More Related