private static byte? GetTypeCode(Type type) {
if (type.IsArray)
return ArrayType;
#if PCL
if (type.IsPrimitive()) {
#else
if (type.IsPrimitive) {
#endif
if (type == typeof(bool))
return BooleanType;
if (type == typeof(byte))
return ByteType;
if (type == typeof(short))
return Int16Type;
if (type == typeof(int))
return Int32Type;
if (type == typeof(long))
return Int64Type;
if (type == typeof(float))
return SingleType;
if (type == typeof(double))
return DoubleType;
}
if (type == typeof (string))
return StringType;
#if PCL
if (type.GetTypeInfo().IsDefined(typeof(SerializableAttribute)))
#else
if (Attribute.IsDefined(type, typeof(SerializableAttribute)))
#endif
return ObjectType;
return null;
}