Created
October 22, 2020 16:02
-
-
Save xCyborg/fe08af560656b0c1193936bcea7fec0e to your computer and use it in GitHub Desktop.
Patterns like _enum_class_ and _singletons_
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 Planet // enum class | |
{ | |
public static readonly Planet MERCURY = new Planet(1, "Mercury"); | |
public static readonly Planet VENUS = new Planet(2, "Venus"); | |
public static readonly Planet EARTH = new Planet(3, "Earth"); | |
public static readonly Planet MARS = new Planet(4, "Mars"); | |
public static readonly Planet JUPITER = new Planet(5, "Jupiter"); | |
public static readonly Planet SATURN = new Planet(6, "Saturn"); | |
public static readonly Planet URANNUS = new Planet(7, "Uranus"); | |
public static readonly Planet NEPTUNE = new Planet(8, "Naptune"); | |
public int ID => this.id; | |
public string Name => this.name; | |
private readonly int id; | |
private readonly string name; | |
private Planet(int id, string name) | |
{ | |
this.id = id; | |
this.name = name; | |
} | |
} |
Author
xCyborg
commented
May 30, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment