Re: [ADVANCED-DOTNET] Method that returns List

2007-12-17 Thread Mark Brackett
Original Message- > From: Discussion of advanced .NET topics. [mailto:ADVANCED- > [EMAIL PROTECTED] On Behalf Of Bob Provencher > Sent: Friday, December 14, 2007 1:58 PM > To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM > Subject: Re: [ADVANCED-DOTNET] Method that returns List > > I t

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-16 Thread Ron Young
OTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List > Anyways, we have a service contract for IReporting, and a ReportManager > implementation class. > > public IList GetReport(string reportName, Criteria c); Rather than exposing and requiring a base class,

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Curt Hagenlocher
On 12/14/07, Marc Brooks <[EMAIL PROTECTED]> wrote: > > Eric Lippert (CLR ninja at Microsoft) has been writing a facination > series of blog posts about the current and (possible) future support > for these very concepts in an upcoming release of the CLR. I recommend > the series AND the comments a

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Marc Brooks
> Anyways, we have a service contract for IReporting, and a ReportManager > implementation class. > > public IList GetReport(string reportName, Criteria c); Rather than exposing and requiring a base class, you should REALLY expose an interface for your contract. That way nobody _has_ to inherit

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Marc Brooks
Eric Lippert (CLR ninja at Microsoft) has been writing a facination series of blog posts about the current and (possible) future support for these very concepts in an upcoming release of the CLR. I recommend the series AND the comments as excellent learning fodder. http://blogs.msdn.com/ericlipper

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ron Young
to one of our data contract types. From: Discussion of advanced .NET topics. [EMAIL PROTECTED] On Behalf Of Ryan Heath [EMAIL PROTECTED] Sent: Friday, December 14, 2007 1:28 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List Make the ctor static

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ryan Heath
Dispose(); > >return resultset; >} >} > > ____________ > From: Discussion of advanced .NET topics. [EMAIL PROTECTED] On Behalf Of Bob > Provencher [EMAIL PROTECTED] > Sent: Friday, December 14, 2007 12:58 PM > >

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Bob Provencher
@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List I think that if you add a different kind of report in the GetReports() method it might through an error though public List GetReports() { List reports = new List(); reports.Add(new Report

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ron Young
return resultset; } } From: Discussion of advanced .NET topics. [EMAIL PROTECTED] On Behalf Of Bob Provencher [EMAIL PROTECTED] Sent: Friday, December 14, 2007 12:58 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Bob Provencher
PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List Indeed it does. Thank you. I was under the impression that if the method that returned derived reports ultimately returned a list of the base report, then the client would get the properties defined i

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Brandon Willoughby
OTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List I believe if you change your List (inside of GetReports()) to type List it might work... Brandon Ron Young wrote: Is the following possible? The compiler tells me no: class Report { } class ReportA : Report { public s

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ron Young
:51 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List On 12/14/07, Ron Young <[EMAIL PROTECTED]> wrote: > Is the following possible? The compiler tells me no: > > public List GetReports() > { >Li

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Curt Hagenlocher
On 12/14/07, Ron Young <[EMAIL PROTECTED]> wrote: > Is the following possible? The compiler tells me no: > > public List GetReports() > { >List reports = new List(); >reports.Add(new Report()); >return reports; > } Covariance is not supported for gen

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ron Young
Sent: Friday, December 14, 2007 12:44 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Method that returns List I believe if you change your List (inside of GetReports()) to type List it might work... Brandon Ron Young wrote: > Is the following possible? The compiler

Re: [ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Brandon Willoughby
I believe if you change your List (inside of GetReports()) to type List it might work... Brandon Ron Young wrote: Is the following possible? The compiler tells me no: class Report { } class ReportA : Report { public string MyName = "ReportA"; } class ReportProvider { public List Ge

[ADVANCED-DOTNET] Method that returns List

2007-12-14 Thread Ron Young
Is the following possible? The compiler tells me no: class Report { } class ReportA : Report { public string MyName = "ReportA"; } class ReportProvider { public List GetReports() { List reports = new List(); reports.Add(new Report()); return rep