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

27 lines
701 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 ResearchesData:IEquatable<ResearchesData>
{
public string name; // 课题组名称
// 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法
public bool Equals(ResearchesData other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return name == other.name;
}
public override int GetHashCode()
{
return HashCode.Combine(name);
}
public override string ToString()
{
return $"课题组名称: {name}";
}
}