Skip to content

Instantly share code, notes, and snippets.

@mahizsas
Forked from jmhdez/Id.cs
Created May 6, 2013 19:46
Show Gist options
  • Select an option

  • Save mahizsas/5527618 to your computer and use it in GitHub Desktop.

Select an option

Save mahizsas/5527618 to your computer and use it in GitHub Desktop.
public struct Id<T>
{
public readonly int Value;
public Id(int value)
{
this.value = value;
}
public static implicit operator Id<T>(int value)
{
return new Id<T>(value);
}
public override bool Equals(object obj)
{
return obj is Id<T> && ((Id<T>) obj).value == value;
}
public override int GetHashCode()
{
return value.GetHashCode();
}
public override string ToString()
{
return value.ToString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment