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

31 lines
985 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;
// 通知数据结构
[Serializable]
public class NoticeData:IEquatable<NoticeData>
{
public string createTime; // 创建时间
public string noticeTitle; // 通知标题
public string noticeContent; // 通知内容
// 实现IEquatable接口的Equals方法以及重写GetHashCode方法以及ToString方法
public bool Equals(NoticeData other)
{
if (other is null) return false;
if (ReferenceEquals(this, other)) return true;
return createTime == other.createTime && noticeTitle == other.noticeTitle && noticeContent == other.noticeContent;
}
public override int GetHashCode()
{
return HashCode.Combine(createTime, noticeTitle, noticeContent);
}
public override string ToString()
{
return $"创建时间: {createTime}, 通知标题: {noticeTitle}, 通知内容: {noticeContent}";
}
}