Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2 つのテキスト フィールドがあります。送信が押されたときに、a) フィールドに何も入力されていない場合、または b) 両方のフィールドに入力されている場合にエラー メッセージが表示されるようにします。これはどのように達成できますか?
XOR
if (!(string.IsNullOrEmpty(field1) == string.IsNullOrEmpty(field2))) { throw error }