You can also use ?, enter a list of the following type:
public class MyClass { public string? x {get;set;} public double? y {get;set;} }
That way you can choose if none, one or both can make a difference.
Or, if you do not like the HasValue / Value functions:
public class MyClass { public enum EType { String, Double }; EType TypeFilled {get; private set } string _x; public string X { get { return _x; }; set { _x = value; TypeFilled = EType.String; } double y; public double y { get { return _y; }; set { _y = value; TypeFilled = EType.Double; } }
Thus, the typeFilled property determines what is filled. You can add validation to prevent installation twice, etc.
Michel keijzers
source share