Exemple #1
0
        public static int GetTypeSize(this SCTypeCode type)
        {
            return(type switch
            {
                SCTypeCode.Bool3 => sizeof(bool),

                SCTypeCode.Byte => sizeof(byte),
                SCTypeCode.UInt16 => sizeof(ushort),
                SCTypeCode.UInt32 => sizeof(uint),
                SCTypeCode.UInt64 => sizeof(ulong),

                SCTypeCode.SByte => sizeof(sbyte),
                SCTypeCode.Int16 => sizeof(short),
                SCTypeCode.Int32 => sizeof(int),
                SCTypeCode.Int64 => sizeof(long),

                SCTypeCode.Single => sizeof(float),
                SCTypeCode.Double => sizeof(double),

                _ => throw new ArgumentException(type.ToString(), nameof(type))
            });