Esempio n. 1
0
        //static class GenericDelegate<TDelegate> where TDelegate : MulticastDelegate
        //{
        //    // TResult F(Tuple<PhpValue, Context>, arg1, ..., argN) => value.AsCallable().Invoke(Context, new[]{ arg1, ..., argN })
        //    public static readonly MethodInfo/*!*/s_func = CreateFunc();

        //    static MethodInfo CreateFunc()
        //    {

        //    }
        //}

        ///// <summary>
        ///// Converts given value to <see cref="PhpValue"/>.
        ///// </summary>
        ///// <typeparam name="T">Source CLR type.</typeparam>
        ///// <param name="value">Value to be converted.</param>
        ///// <returns>Value converted to <see cref="PhpValue"/>.</returns>
        //public static PhpValue ToPhpValue<T>(this T value) => GenericConverter<T>.s_toPhpValue(value);

        /// <summary>
        /// Casts <see cref="PhpValue"/> to a given type <typeparamref name="T"/>.
        /// Throws an exception if cast is not possible.
        /// </summary>
        /// <typeparam name="T">Conversion target.</typeparam>
        /// <param name="value">Value to be converted.</param>
        /// <returns>Value as <typeparamref name="T"/>.</returns>
        public static T Cast <T>(this PhpValue value) => GenericConverter <T> .s_fromPhpValue(value);