Can C# make my class look like another class?

Posted by Vaccano on Stack Overflow See other posts from Stack Overflow or by Vaccano
Published on 2010-03-23T21:41:40Z Indexed on 2010/03/23 21:43 UTC
Read the original article Hit count: 187

Filed under:
|

I have a class that look like this:

public class BasePadWI
{
    public WorkItem WorkItemReference { get; set; }
    .... Other stuff ......
}

I then have a dictionary that is defined like this:

public Dictionary<BasePadWI, Canvas> Pad { get; set; }

I would then like to make a call like this:

List<WorkItem> workItems = Pad.Keys.ToList();

(Note: WorkItem is a sealed class, so I cannot inherit.)

Is there some trickery that I could do in the class to make it look like a WorkItem?

I have done this in the mean time:

List<WorkItem> workItems = Pad.Keys.ToList().ConvertAll(x=>x.WorkItem);

© Stack Overflow or respective owner

Related posts about c#

Related posts about c#3.0