in cs/src/core/Reflection.cs [203:272]
public static BondDataType GetBondDataType(this Type type)
{
while (true)
{
if (type.IsBondStruct() || type.IsBonded())
return BondDataType.BT_STRUCT;
if (type.IsBondNullable())
return BondDataType.BT_LIST;
if (type.IsBondMap())
return BondDataType.BT_MAP;
if (type.IsBondSet())
return BondDataType.BT_SET;
if (type.IsBondList() || type.IsBondBlob())
return BondDataType.BT_LIST;
if (type.IsEnum())
return BondDataType.BT_INT32;
if (type == typeof(string))
return BondDataType.BT_STRING;
if (type == typeof(Tag.wstring))
return BondDataType.BT_WSTRING;
if (type == typeof(bool))
return BondDataType.BT_BOOL;
if (type == typeof(byte))
return BondDataType.BT_UINT8;
if (type == typeof(UInt16))
return BondDataType.BT_UINT16;
if (type == typeof(UInt32))
return BondDataType.BT_UINT32;
if (type == typeof(UInt64))
return BondDataType.BT_UINT64;
if (type == typeof(float))
return BondDataType.BT_FLOAT;
if (type == typeof(double))
return BondDataType.BT_DOUBLE;
if (type == typeof(sbyte))
return BondDataType.BT_INT8;
if (type == typeof(Int16))
return BondDataType.BT_INT16;
if (type == typeof(Int32))
return BondDataType.BT_INT32;
if (type == typeof(Int64))
return BondDataType.BT_INT64;
if (type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(Nullable<>))
{
type = type.GetValueType();
continue;
}
return BondDataType.BT_UNAVAILABLE;
}
}