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.
正しいチェックは何ですか:
Guid value; // ... if (value != Guid.Empty)
また
if (value != default(Guid))
私は2番目だと思いますが、理由を説明できません。
以下を使用する必要があります。
var guidIsEmpty = value == Guid.Empty;
どちらも技術的には正しいですが、Guid.Empty と比較すると、間違いなくコードが読みやすくなります。