System.Runtime.Serialization.Plists.EndianConverter.ToBigEndianConditional C# (CSharp) Method

ToBigEndianConditional() public static method

Gets the big-endian value of the given value if the current system is little-endian. If the current system is big-endian, returns the value as-is.
public static ToBigEndianConditional ( this value ) : int
value this The value to swap if necessary.
return int
        public static int ToBigEndianConditional(this int value)
        {
            if (BitConverter.IsLittleEndian)
            {
                return value.SwapEndian();
            }

            return value;
        }

Same methods

EndianConverter::ToBigEndianConditional ( this value ) : long
EndianConverter::ToBigEndianConditional ( this value ) : short
EndianConverter::ToBigEndianConditional ( this value ) : uint
EndianConverter::ToBigEndianConditional ( this value ) : ulong
EndianConverter::ToBigEndianConditional ( this value ) : ushort