Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- namespace yournamespace
- {
- public class Gizmo : IEquatable<Gizmo>
- {
- public string Name { get; set; }
- public string Pattern { get; set; }
- public Color ForegroundColor { get; set; }
- public Color BackgroundColor { get; set; }
- public override bool Equals(object obj)
- {
- if (obj == null)
- {
- return false;
- }
- return Equals(obj as Gizmo);
- }
- public bool Equals(Gizmo other)
- {
- if ((object)other == null)
- {
- return false;
- }
- return
- Name == other.Name &&
- Pattern == other.Pattern &&
- ForegroundColor == other.ForegroundColor &&
- BackgroundColor == other.BackgroundColor;
- }
- public override int GetHashCode()
- {
- return new HashCode()
- .Hash(Name)
- .Hash(Pattern)
- .Hash(ForegroundColor)
- .Hash(BackgroundColor)
- .Value;
- }
- public static bool operator ==(Gizmo left, Gizmo right)
- {
- if (object.ReferenceEquals(left, right))
- {
- return true;
- }
- if (((object)left == null) || ((object)right == null))
- {
- return false;
- }
- return left.Equals(right);
- }
- public static bool operator !=(Gizmo left, Gizmo right)
- {
- return !(left == right);
- }
- }
- }
Add Comment
Please, Sign In to add comment