I'm implementing a "save/load" function in my app. There are various types of Vertex
object that have a lot of static fields, but apparently you can't serialize static fields. I'm making a class whose instance contains these fields, and to avoid too much code to populate these fields I'm implementing them as properties.
However, the syntax to do this seems too bulky, so I'm looking for a way to simplify this:
public Color CircleFillColor { get => CircleVertex.fillColor; set => CircleVertex.fillColor = value; }
public Color SquareFillColor { get => SquareVertex.fillColor; set => SquareVertex.fillColor = value; }
public Color TriangleFillColor { get => TriangleVertex.fillColor; set => TriangleVertex.fillColor = value; }
If we had macros in C#, I could write something like this:
#define passthru(F) { get => F; set => F = value; }
public Color CircleFillColor passthru(CircleVertex.fillColor)
public Color SquareFillColor passthru(SquareVertex.fillColor)
public Color TriangleFillColor passthru(TriangleVertex.fillColor)
Is there any shorthand for properties like this?