Ejemplo n.º 1
0
 /// <summary>
 /// Creates an object instance that derives from class <typeparamref name="TProxy"/>
 /// and implements interface <typeparamref name="T"/>.
 /// </summary>
 /// <typeparam name="T">The interface the proxy should implement.</typeparam>
 /// <typeparam name="TProxy">The base class to use for the proxy class.</typeparam>
 /// <returns>An object instance that implements <typeparamref name="T"/>.</returns>
 /// <exception cref="System.ArgumentException"><typeparamref name="T"/> is a class,
 /// or <typeparamref name="TProxy"/> is sealed or does not have a parameterless constructor</exception>
 public static T Create <T, TProxy>()
     where TProxy : DispatchProxy
 {
     return((T)DispatchProxyGenerator.CreateProxyInstance(typeof(TProxy), typeof(T)));
 }
 /// <summary>
 /// Creates an object instance that derives from class <typeparamref name="TProxy"/>
 /// and implements interface <typeparamref name="T"/>.
 /// </summary>
 /// <typeparam name="T">The interface the proxy should implement.</typeparam>
 /// <typeparam name="TProxy">The base class to use for the proxy class.</typeparam>
 /// <returns>An object instance that implements <typeparamref name="T"/>.</returns>
 /// <exception cref="System.ArgumentException"><typeparamref name="T"/> is a class,
 /// or <typeparamref name="TProxy"/> is sealed or does not have a parameterless constructor</exception>
 public static T Create <T, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] TProxy>()
     where TProxy : DispatchProxy
 {
     return((T)DispatchProxyGenerator.CreateProxyInstance(typeof(TProxy), typeof(T)));
 }