Skip to content

Instantly share code, notes, and snippets.

@NeilRobbins
Created March 28, 2014 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeilRobbins/9831188 to your computer and use it in GitHub Desktop.
Save NeilRobbins/9831188 to your computer and use it in GitHub Desktop.
Simple Type Aliasing in C#
public class WeekKey
{
private int value;
public static implicit operator int(WeekKey weekKey) { return weekKey.value; }
public static implicit operator WeekKey(int weekKey) { return new WeekKey { value = weekKey }; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment