Created
March 28, 2014 12:06
-
-
Save NeilRobbins/9831188 to your computer and use it in GitHub Desktop.
Simple Type Aliasing in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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