FromObject() public static méthode

Creates a JavaScript value that is a projection of the passed in object
Requires an active script context.
public static FromObject ( object value ) : EdgeJsValue
value object The object to be projected
Résultat EdgeJsValue
        public override void EmbedHostType(string itemName, Type type)
        {
            InvokeScript(() =>
            {
#if NETSTANDARD1_3
                EdgeJsValue typeValue = CreateObjectFromType(type);
#else
                EdgeJsValue typeValue = EdgeJsValue.FromObject(new HostType(type, _engineMode));
#endif
                EdgeJsValue.GlobalObject.SetProperty(itemName, typeValue, true);
            });
        }
        /// <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 EdgeJsValue MapToScriptType(object value)
        {
            if (value == null)
            {
                return(EdgeJsValue.Null);
            }

            if (value is Undefined)
            {
                return(EdgeJsValue.Undefined);
            }

            var typeCode = value.GetType().GetTypeCode();

            switch (typeCode)
            {
            case TypeCode.Boolean:
                return((bool)value ? EdgeJsValue.True : EdgeJsValue.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(EdgeJsValue.FromInt32(Convert.ToInt32(value)));

            case TypeCode.Single:
            case TypeCode.Double:
            case TypeCode.Decimal:
                return(EdgeJsValue.FromDouble(Convert.ToDouble(value)));

            case TypeCode.Char:
            case TypeCode.String:
                return(EdgeJsValue.FromString((string)value));

            default:
#if NETSTANDARD1_3
                return(FromObject(value));
#else
                object processedValue = !TypeConverter.IsPrimitiveType(typeCode) ?
                                        new HostObject(value, _engineMode) : value;
                return(EdgeJsValue.FromObject(processedValue));
#endif
            }
        }