encompass-cs/encompass-cs/Entity.cs

45 lines
855 B
C#

using System;
namespace Encompass
{
public struct Entity : IEquatable<Entity>
{
public readonly Guid ID;
internal Entity(Guid id)
{
this.ID = id;
}
public override bool Equals(object obj)
{
if (obj is Entity)
{
return this.Equals((Entity)obj);
}
return false;
}
public bool Equals(Entity other)
{
return other.ID == ID;
}
public static bool operator ==(Entity one, Entity two)
{
return one.Equals(two);
}
public static bool operator !=(Entity one, Entity two)
{
return !one.Equals(two);
}
public override int GetHashCode()
{
return ID.GetHashCode();
}
}
}