public TAdapter CreateAdapter <TAdapter>() where TAdapter : RhspAdapter { TAdapter adapter = LocalContext.Default.CreateAdapter <TAdapter>(); adapter.ErrorOccured += new RhspAdapterErrorEventHandler(adapter_ErrorOccured); return(adapter); }
public TAdapter CreateAdapter <TAdapter>() where TAdapter : RhspAdapter { ConstructorInfo constructor = typeof(TAdapter).GetConstructor(new Type[] { }); if (constructor == null) { throw new InvalidOperationException( "Unable to find empty public constructor for '" + typeof(TAdapter).Name + "'"); } TAdapter adapter = (TAdapter)constructor.Invoke(new object[] { }); adapter.Initialize(manager); return((TAdapter)adapter); }