AsmResolver.Net.Signatures.ElementSignature.GetPhysicalLength C# (CSharp) Method

GetPhysicalLength() public method

public GetPhysicalLength ( ) : uint
return uint
        public override uint GetPhysicalLength()
        {
            if (Value == null)
                throw new NotSupportedException();

            switch(Type.GetTypeCode(Value.GetType()))
            {
                case TypeCode.Boolean:
                case TypeCode.Byte:
                case TypeCode.SByte:
                    return sizeof (byte);
                case TypeCode.Char:
                case TypeCode.Int16:
                case TypeCode.UInt16:
                    return sizeof (ushort);
                case TypeCode.Single:
                case TypeCode.Int32:
                case TypeCode.UInt32:
                    return sizeof(uint);
                case TypeCode.Double:
                case TypeCode.Int64:
                case TypeCode.UInt64:
                    return sizeof (ulong);
                case TypeCode.String:
                    return ((Value as string).GetSerStringSize());
            }

            var typeSignature = Value as TypeSignature;
            if (typeSignature != null)
                return TypeNameBuilder.GetAssemblyQualifiedName(typeSignature).GetSerStringSize();

            throw new NotSupportedException();
        }