Click here to Skip to main content
15,885,101 members
Home / Discussions / C#
   

C#

 
QuestionNeed help with co/contravariance and generic lists :s Pin
Lee Reid5-Sep-10 23:12
Lee Reid5-Sep-10 23:12 
AnswerRe: Need help with co/contravariance and generic lists :s Pin
Kubajzz5-Sep-10 23:50
Kubajzz5-Sep-10 23:50 
GeneralRe: Need help with co/contravariance and generic lists :s [modified] Pin
Lee Reid6-Sep-10 0:41
Lee Reid6-Sep-10 0:41 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Kubajzz6-Sep-10 1:06
Kubajzz6-Sep-10 1:06 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Lee Reid6-Sep-10 2:02
Lee Reid6-Sep-10 2:02 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Kubajzz6-Sep-10 2:13
Kubajzz6-Sep-10 2:13 
AnswerRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 0:41
professionalDaveyM696-Sep-10 0:41 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Lee Reid6-Sep-10 1:12
Lee Reid6-Sep-10 1:12 
Cheers Dave,
From what I understand unfortunately this seems to make a copy of the original - meaning that a list<B> is not actually contained within a List, but rather its contents are copied across. (Or am I mistaken??)


List<B> listB = new List<B>();
List<C> listC = new List<C>();

List<A>[] arrayOfLists = new List<A>[2];
arrayOfLists[0] = DerivedConverter<A, B>(listB);

//listB count = 0, arrayOfLists[0].count = 0

listB.Add(new B());

//listB count = 1, but arrayOfLists[0].count = 0. I would want them BOTH to have counts of 1


If i create a list<B> and a list<A>, changes made to listB need to be seen in listA. Sorry for the lack of clarity Frown | :(

GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 1:31
professionalDaveyM696-Sep-10 1:31 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 1:54
professionalDaveyM696-Sep-10 1:54 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Lee Reid6-Sep-10 2:08
Lee Reid6-Sep-10 2:08 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
DaveyM696-Sep-10 2:13
professionalDaveyM696-Sep-10 2:13 
GeneralRe: Need help with co/contravariance and generic lists :s Pin
Pete O'Hanlon6-Sep-10 3:41
mvePete O'Hanlon6-Sep-10 3:41 
AnswerRe: Need help with co/contravariance and generic lists :s Pin
PIEBALDconsult6-Sep-10 7:32
mvePIEBALDconsult6-Sep-10 7:32 
QuestionHow to deploy an Outlook 2003 add-in application(C# and VS 2008)? Pin
milestanley5-Sep-10 22:57
milestanley5-Sep-10 22:57 
QuestionCould use some help please. Pin
pestman5-Sep-10 22:01
pestman5-Sep-10 22:01 
AnswerRe: Could use some help please. Pin
Kubajzz5-Sep-10 22:21
Kubajzz5-Sep-10 22:21 
GeneralRe: Could use some help please. Pin
pestman6-Sep-10 6:27
pestman6-Sep-10 6:27 
GeneralRe: Could use some help please. Pin
Kubajzz6-Sep-10 9:51
Kubajzz6-Sep-10 9:51 
Question"Cannot connect back" - Visual Studio 2008 Remote Debugger for C# apps Pin
Maxwell Chen5-Sep-10 20:19
Maxwell Chen5-Sep-10 20:19 
QuestionQuestion about RegEx Class Pin
Mazdak5-Sep-10 16:24
Mazdak5-Sep-10 16:24 
Answercross-post Pin
Luc Pattyn5-Sep-10 16:54
sitebuilderLuc Pattyn5-Sep-10 16:54 
AnswerRe: Question about RegEx Class [modified] Pin
PIEBALDconsult5-Sep-10 17:34
mvePIEBALDconsult5-Sep-10 17:34 
QuestionNot able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 2:39
Aseem Sharma5-Sep-10 2:39 
AnswerRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Not Active5-Sep-10 3:04
mentorNot Active5-Sep-10 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.