コード例 #1
0
        public TAdapter CreateAdapter <TAdapter>()
            where TAdapter : RhspAdapter
        {
            TAdapter adapter = LocalContext.Default.CreateAdapter <TAdapter>();

            adapter.ErrorOccured += new RhspAdapterErrorEventHandler(adapter_ErrorOccured);
            return(adapter);
        }
コード例 #2
0
        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);
        }