Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Guard Clauses in User Registration | Custom Exceptions and Guard Clauses
C# Exceptions and Error Handling Practice
セクション 2.  4
single

single

bookChallenge: Guard Clauses in User Registration

メニューを表示するにはスワイプしてください

タスク

スワイプしてコーディングを開始

Write a method to register a user that uses guard clauses to validate the provided username and password.

  • If username is null or empty, immediately throw an ArgumentException with the message "Username cannot be null or empty.".
  • If password is null or empty, immediately throw an ArgumentException with the message "Password cannot be null or empty.".
  • If both inputs are valid, return a string in the format "User '' registered successfully.".

解答

Switch to desktop実践的な練習のためにデスクトップに切り替える下記のオプションのいずれかを利用して、現在の場所から続行する
すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  4
single

single

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

some-alt