public void Add(ICubeValue cubeValue) { var otherValue = cubeValue as LongValue; if (otherValue == null) { throw new InvalidOperationException($"Unable to add value of type '{cubeValue.GetType()}'"); } this.Value += otherValue.Value; }
public void Add(ICubeValue cubeValue) { if (cubeValue == null) { throw new ArgumentNullException(nameof(cubeValue)); } if (!(cubeValue is ValueDouble cubeValueAsValueDouble)) { throw new InvalidOperationException($"Unable to add a non-ValueDouble instance to this. Added type -{cubeValue.GetType().Name}"); } this.Value += cubeValueAsValueDouble.Value; }