How can I make this C# method more generic?
<p>I have this method:</p>

<pre><code>public partial class Client : ConfigItem
{
    public void ValidateForInsert(ASystem defaultSystem, IEnumerable&lt;Client&gt; currentConfig)
    {
        if (this.Source == defaultSystem.SystemName)
        {
            throw new InvalidOperationException(AMessage);
        }
        if (SomeOtherValidation())
        {
            throw new InvalidOperationException(AnOtherMessage);
        }
    }
}
</code></pre>

<p>It's going to exist on many different types, all of which inherit from CofigItem</p>

<p>All the code is identical, so I want to move it to the base class.
Except the parameters contain 
IEnumerable&lt;<em>ThisClassesType</em>> currentConfig</p>

<p>If I put it in the base class with <code>IEnumerable&lt;ConfigItem&gt;</code>, I have to call it with:</p>

<p><code>client.ValidateOnInsert(defaultSystem, currentConfig.Cast&lt;ConfigItem&gt;());</code></p>

<p>Which seems a bit daft as types of things like <code>client</code> will <em>always</em> be based off of <code>ConfigItem</code>.</p>

<p>Is there anyway to put something like:</p>

<p><code>public void ValidateOnInsert(ASystem system, IEnumerable&lt;T&gt; currentConfig) where T : ConfigItem</code>(?)</p>

<p>Or just any way of making that neat, tidy and not require duplicate code or lots of casting?</p>

<p>Thanks,</p>

<p><code>J1M</code></p>
