NG_/Assets/Scripts/Data/Entity/DeptData.cs

29 lines
801 B
C#
Raw Normal View History

2024-12-13 19:40:05 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 空间
[System.Serializable]
public class DeptData:IEquatable<DeptData>
{
public string deptName; // 空间ID
public string labName; // 实验室名称
// 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法
public bool Equals(DeptData other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return deptName == other.deptName && labName == other.labName;
}
public override int GetHashCode()
{
return HashCode.Combine(deptName, labName);
}
public override string ToString()
{
return $"空间ID: {deptName}, 实验室名称: {labName}";
}
}