Ejemplo n.º 1
0
 /// <summary>
 /// Creates a <see cref="Func{T}"/> delegate for a given <see cref="Func{Object}"/> delegate.
 /// </summary>
 /// <param name="typeArg">The <c>T</c> type argument for the returned function's return type.</param>
 /// <param name="func">The function that produces the T value typed as <see cref="object"/>.</param>
 /// <returns>An instance of <see cref="Func{T}"/>, typed as <see cref="Func{Object}"/>.</returns>
 public static Func <object> CreateFuncOfType(Type typeArg, Func <object> func)
 {
     return(DelegateServices.As(func, typeArg));
 }
Ejemplo n.º 2
0
 internal static Lazy <T> FromValue <T>(T value)
     where T : class
 {
     return(new Lazy <T>(DelegateServices.FromValue(value), LazyThreadSafetyMode.PublicationOnly));
 }