public static FromInt32 ( int value ) : |
||
value | int | The value to be converted |
Résultat |
/// <summary> /// Makes a mapping of value from the host type to a script type /// </summary> /// <param name="value">The source value</param> /// <returns>The mapped value</returns> private IeJsValue MapToScriptType(object value) { if (value == null) { return(IeJsValue.Null); } if (value is Undefined) { return(IeJsValue.Undefined); } var typeCode = value.GetType().GetTypeCode(); switch (typeCode) { case TypeCode.Boolean: return((bool)value ? IeJsValue.True : IeJsValue.False); case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: case TypeCode.UInt32: case TypeCode.Int64: case TypeCode.UInt64: return(IeJsValue.FromInt32(Convert.ToInt32(value))); case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: return(IeJsValue.FromDouble(Convert.ToDouble(value))); case TypeCode.Char: case TypeCode.String: return(IeJsValue.FromString((string)value)); default: #if NETSTANDARD1_3 return(FromObject(value)); #else object processedValue = !TypeConverter.IsPrimitiveType(typeCode) ? new HostObject(value, _engineMode) : value; return(IeJsValue.FromObject(processedValue)); #endif } }