Src/Pscx.Core/Commands/PscxCmdlet.cs
/// <summary>
/// Registers a delegate called when specified type of object
/// is read from the pipeline.
/// </summary>
/// <remarks>
/// You may register an interface type too, but they are processed only when
/// there is no handler available for the actual type.
/// </remarks>
/// <example>
/// <para>For example, if you register the following types, the IDisposable handler 
/// will be executed only on objects which do not inherit from Stream.</para>
/// <code>
///     RegisterInputType&lt;IDisposable&gt;(/* ... */);
///     RegisterInputType&lt;FileStream&gt;(/* ... */);
///     RegisterInputType&lt;Stream&gt;(/* ... */);
/// </code>
/// </example>
/// <typeparam name="T">The type which should be processed. </typeparam>
/// <param name="action">
/// The delegate that is called when the object is available.
/// </param>
Registers a delegate called when specified type of object
is read from the pipeline.
Registers a delegate called when specified type of object is read from the pipeline .
protected void RegisterInputType<T>(Action<T> action)
        {
            PscxArgumentException.ThrowIfIsNull(action,
                "To ignore an input type, use IgnoreInputType<T>().");
            PscxArgumentException.ThrowIf(typeof(T) == typeof(Object),
                "You cannot register an action for Object. Override the ProcessInputObject method instead.");
            PscxArgumentException.ThrowIf(typeof(T) == typeof(PSObject),
                "You cannot register an action for PSObject. Override the ProcessInputObject method instead.");
            if (_recurseIEnumerable)
            {
                PscxArgumentException.ThrowIf(typeof(T) == typeof(IEnumerable),
                    "You cannot register an action for IEnumerable when ProcessIEnumerableRecursively is true.");
            }
            SetTypeAction(typeof(T), action);
        }
protected void RegisterInputType < T > ( Action < T > action ) { PscxArgumentException . ThrowIfIsNull ( action , " " ) ; PscxArgumentException . ThrowIf ( typeof ( T ) == typeof ( Object ) , " " ) ; PscxArgumentException . ThrowIf ( typeof ( T ) == typeof ( PSObject ) , " " ) ; if ( _recurseIEnumerable ) { PscxArgumentException . ThrowIf ( typeof ( T ) == typeof ( IEnumerable ) , " " ) ; } SetTypeAction ( typeof ( T ) , action ) ; }
Registers a delegate called when specified type of object
is read from the pipeline.
Registers a delegate called when specified type of object is read from the pipeline .
action
Action<T>
The delegate that is called when the object is available.
The delegate that is called when the object is available .
remarks
You may register an interface type too, but they are processed only when
there is no handler available for the actual type.
You may register an interface type too but they are processed only when there is no handler available for the actual type .
example
For example, if you register the following types, the IDisposable handler
will be executed only on objects which do not inherit from Stream.
RegisterInputType( ... */);
RegisterInputType( ... */);
RegisterInputType( ...
For example if you register the following types the IDisposable handler will be executed only on objects which do not inherit from Stream . RegisterInputType ( ... * / ) ; RegisterInputType ( ... * / ) ; RegisterInputType ( ...
typeparam
The type which should be processed.
The type which should be processed .