/// <summary> /// Inherited from <see cref="ISerializableByteArray"/>. Sets the current <see cref="SizeByte"/> structure from the byte array. /// </summary> public void FromBytes(byte[] data) { if (data.Length != SizeInBytes) { throw new ArgumentException($"Parameter {nameof(data)} must be exactly {SizeInBytes} bytes."); } this = new SizeByte(data[0], data[1]); }
/// <summary> /// Offsets a <see cref="PointShort"/> by the specified <see cref="SizeByte"/>. /// </summary> /// <param name="pt">The <see cref="PointShort"/> that should be offset.</param> /// <param name="sz">The <see cref="SizeByte"/> to offset by.</param> /// <returns>A new <see cref="PointShort"/> that has been offset.</returns> public static PointShort Add(PointShort pt, SizeByte sz) => pt + sz;
/// <summary> /// Subtracts a <see cref="PointShort"/> by a <see cref="SizeByte"/>. /// </summary> /// <param name="pt">The <see cref="PointShort"/> to be subtracted from.</param> /// <param name="sz">The <see cref="SizeByte"/> to subtract.</param> /// <returns>A <see cref="PointShort"/> representing the difference.</returns> public static PointShort Subtract(PointShort pt, SizeByte sz) => pt - sz;
/// <summary> /// Subtracs two <see cref="SizeByte"/> values and returns the result. /// </summary> /// <param name="sz1">The intial <see cref="SizeByte"/>.</param> /// <param name="sz2">The <see cref="SizeByte"/> to subtract.</param> /// <returns>The difference between the two <see cref="SizeByte"/> structures.</returns> public static SizeByte Subtract(SizeByte sz1, SizeByte sz2) => sz1 - sz2;
/// <summary> /// Adds two <see cref="SizeByte"/> values together and returns the result. /// </summary> /// <param name="sz1">The first <see cref="SizeByte"/> to add.</param> /// <param name="sz2">The second <see cref="SizeByte"/> to add.</param> /// <returns>The sum of the two <see cref="SizeByte"/> structures.</returns> public static SizeByte Add(SizeByte sz1, SizeByte sz2) => sz1 + sz2;