Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Created February 1, 2015 08:51
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 ufcpp/9f9f129eee95231de81f to your computer and use it in GitHub Desktop.
Save ufcpp/9f9f129eee95231de81f to your computer and use it in GitHub Desktop.
Immutable class must have all properties read-only, much annoyed to implement
class Point
{
public int X { get { return _x; } }
private readonly int _x;
public int Y { get { return _y; } }
private readonly int _y;
public Point(int x, int y)
{
_x = x;
_y = y;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment