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.
Zero/ZeroLevel/Models/BaseModel.cs

40 lines
1.1 KiB

6 years ago
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)
6 years ago
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();
}
}

Powered by TurnKey Linux.