/*------------------------------------------------------------------------- * 功能描述:BimId * 作者:xulisong * 创建时间: 2019/6/13 9:57:38 * 版本号:v1.0 * -------------------------------------------------------------------------*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JBIM { /* * 定义BimId类,初始化相关ID类型的引用 * 引入该类,是为了方便在Id这一类型上的扩展,毕竟它和普通的基本类型有所不同 */ /// /// bimId类 /// public class BimId { public BimId(string id) { this.Id = id; } /// /// Id值 /// public string Id { get; private set; } public override string ToString() { return Id?.ToString() ?? string.Empty; } public override bool Equals(object obj) { if (obj is BimId inputId) { return Id == inputId.Id; } return false; } public override int GetHashCode() { if (string.IsNullOrWhiteSpace(Id)) { return 0; } return Id.GetHashCode(); } public static bool operator ==(BimId a, BimId b) { if ((object)a == null) { return (object)b == null; } return a.Equals(b); } public static bool operator !=(BimId a, BimId b) { if ((object)a == null) { return ((object)b != null); } return !a.Equals(b); } } }