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 中返回 null 而不是返回 Guid.empty。这是代码:
ConsumerID = (subList == null ? Guid.Empty : subList.ConsumerID)
谢谢
Guid类型是 a ,struct所以它不能有Null值。
Guid
struct
Null
改为使用System.Nullable<Guid>,甚至更好,Guid?.
System.Nullable<Guid>
Guid?
var guid = (Guid?)null;
return new Guid[0] 将返回 uuid 类型的新空数组