Covariance huh. Thanks for that too, new word to google. Have read it in a 
couple blogs but it never sunk in.

________________________________________
From: Discussion of advanced .NET topics. [EMAIL PROTECTED] On Behalf Of Curt 
Hagenlocher [EMAIL PROTECTED]
Sent: Friday, December 14, 2007 12:51 PM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Method that returns List<BaseClass>

On 12/14/07, Ron Young <[EMAIL PROTECTED]> wrote:
> Is the following possible? The compiler tells me no:
>
>     public List<Report> GetReports()
>     {
>            List<ReportA> reports = new List<ReportA>();
>            reports.Add(new Report());
>            return reports;
>     }

Covariance is not supported for generics in C#, though I think the
underlying CLR does actually allow it.

--
Curt Hagenlocher
[EMAIL PROTECTED]

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to