c# base class as parameter type
<p>I have two classes as following, Class A inherits from Class B.</p>

<pre><code>public class A 
{
     public string Title { get; set; }
}

public class B: A 
{

}
</code></pre>

<p>Then I have a function as following which takes in a list of items of class A</p>

<pre><code>public static void Get(List&lt;A&gt; values)
{
    //do something
}
</code></pre>

<p>Now when I try to pass a list of items of Class B, into the function as following    </p>

<pre><code>private function void Test()
{
     var k = new List&lt;B&gt;();
     Get(k);
}
</code></pre>

<p>I get the following error message</p>

<p>cannot convert from 'System.Collections.Generic.List&lt;B>' to 'System.Collections.Generic.List&lt;A>'  </p>

<p>Should this not work as B just inherits from A and will have the properties that A has?</p>

<p>I have already spent hours trying to look this up but have not been to figure out what I an doing wrong, Please help.</p>
