bloritsch    2003/08/05 07:26:49

  Added:       cscontainer/src/cs AvalonComponentFactory.cs
  Log:
  add start to component factory
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/cscontainer/src/cs/AvalonComponentFactory.cs
  
  Index: AvalonComponentFactory.cs
  ===================================================================
  using System;
  
  namespace Apache.Avalon.Container
  {
        /// <summary>
        /// Summary description for AvalonComponentFactory.
        /// </summary>
        public class AvalonComponentFactory : IComponentFactory
        {
          private Type m_componentType;
  
                public AvalonComponentFactory(Type componentType)
                {
              if (componentType == null) throw new ArgumentNullException( 
"componentType", "We must have a valid component type" );
              m_componentType = componentType;
          }
  
          public object create()
          {
              object component = m_componentType.TypeInitializer.Invoke( null );
              return component;
          }
  
          public void destroy(object component)
          {
              if ( typeof( component ) != typeof( m_componentType ) )
                  throw new ArgumentException( "The component passed in to destroy is 
the wrong type", "component" );
          }
        }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to