Ejemplo n.º 1
0
        /// <summary>
        /// Writes a byte from the <see cref="PacketValueAttribute" /> value of the specified enum value.
        /// </summary>
        /// <param name="builder">The <see cref="IPacketBuilder">packet builder</see> to use.</param>
        /// <param name="enumValue">An enum value decorated with <see cref="PacketValueAttribute" />.</param>
        /// <inheritdoc cref="PacketValueExtensions.ToPacketValue(Enum)" select="exception[@cref='ArgumentException']" />
        /// <inheritdoc cref="PacketValueExtensions.ToPacketValue(Enum)" select="exception[@cref='ArgumentOutOfRangeException']" />
        /// <inheritdoc cref="PacketBuilder.WriteByte(int)" select="exception[@cref='ObjectDisposedException']" />
        public static void WriteByte(this IPacketBuilder builder, Enum enumValue)
        {
            Guard.NotNull(() => builder, builder);

            builder.WriteByte(enumValue.ToPacketValue());
        }