You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace ZeroLevel.Models
|
|
|
|
|
{
|
|
|
|
|
[DataContract]
|
|
|
|
|
[Serializable]
|
|
|
|
|
public abstract class BaseModel
|
|
|
|
|
{
|
|
|
|
|
#region Equal
|
|
|
|
|
public bool Equals(BaseModel other)
|
|
|
|
|
{
|
|
|
|
|
if (this == null) // и так бывает
|
|
|
|
|
throw new NullReferenceException();
|
|
|
|
|
if (other == null)
|
|
|
|
|
return false;
|
|
|
|
|
if (ReferenceEquals(this, other))
|
|
|
|
|
return true;
|
|
|
|
|
if (this.GetType() != other.GetType())
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object obj)
|
|
|
|
|
{
|
|
|
|
|
if (this == null)
|
|
|
|
|
throw new NullReferenceException();
|
|
|
|
|
|
|
|
|
|
return Equals(obj as BaseModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(BaseModel first, BaseModel second) => Equals(first, second);
|
|
|
|
|
public static bool operator !=(BaseModel first, BaseModel second) => !Equals(first, second);
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public abstract override int GetHashCode();
|
|
|
|
|
public abstract object Clone();
|
|
|
|
|
}
|
|
|
|
|
}
|