Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
QuestionWindows Task Scheduler problem Pin
Tridip Bhattacharjee6-Sep-10 1:45
professionalTridip Bhattacharjee6-Sep-10 1:45 
AnswerRe: Windows Task Scheduler problem Pin
Pete O'Hanlon6-Sep-10 2:12
mvePete O'Hanlon6-Sep-10 2:12 
GeneralBSCS FINAL PROJECT Pin
HUSSNAIN TOUFIQ6-Sep-10 0:53
HUSSNAIN TOUFIQ6-Sep-10 0:53 
GeneralRe: BSCS FINAL PROJECT PinPopular
OriginalGriff6-Sep-10 0:57
mveOriginalGriff6-Sep-10 0:57 
GeneralRe: BSCS FINAL PROJECT Pin
dan!sh 6-Sep-10 0:58
professional dan!sh 6-Sep-10 0:58 
GeneralRe: BSCS FINAL PROJECT Pin
Eddy Vluggen6-Sep-10 1:14
professionalEddy Vluggen6-Sep-10 1:14 
GeneralRe: BSCS FINAL PROJECT PinPopular
J4amieC6-Sep-10 1:28
J4amieC6-Sep-10 1:28 
GeneralRe: BSCS FINAL PROJECT Pin
DaveyM696-Sep-10 1:35
professionalDaveyM696-Sep-10 1:35 
GeneralRe: BSCS FINAL PROJECT Pin
Smithers-Jones6-Sep-10 2:12
Smithers-Jones6-Sep-10 2:12 
GeneralRe: BSCS FINAL PROJECT PinPopular
Pete O'Hanlon6-Sep-10 2:25
mvePete O'Hanlon6-Sep-10 2:25 
GeneralRe: BSCS FINAL PROJECT Pin
Smithers-Jones6-Sep-10 2:31
Smithers-Jones6-Sep-10 2:31 
GeneralRe: BSCS FINAL PROJECT Pin
Dave Kreskowiak6-Sep-10 3:52
mveDave Kreskowiak6-Sep-10 3:52 
Generalzoo Pin
Luc Pattyn6-Sep-10 5:15
sitebuilderLuc Pattyn6-Sep-10 5:15 
GeneralRe: BSCS FINAL PROJECT Pin
DaveyM696-Sep-10 2:38
professionalDaveyM696-Sep-10 2:38 
GeneralRe: BSCS FINAL PROJECT Pin
Smithers-Jones6-Sep-10 2:39
Smithers-Jones6-Sep-10 2:39 
GeneralRe: BSCS FINAL PROJECT Pin
Pete O'Hanlon6-Sep-10 2:41
mvePete O'Hanlon6-Sep-10 2:41 
GeneralRe: BSCS FINAL PROJECT Pin
DaveyM696-Sep-10 3:05
professionalDaveyM696-Sep-10 3:05 
GeneralRe: BSCS FINAL PROJECT Pin
Pete O'Hanlon6-Sep-10 3:15
mvePete O'Hanlon6-Sep-10 3:15 
GeneralRe: BSCS FINAL PROJECT Pin
DaveyM696-Sep-10 4:19
professionalDaveyM696-Sep-10 4:19 
GeneralRe: BSCS FINAL PROJECT Pin
Mycroft Holmes6-Sep-10 22:51
professionalMycroft Holmes6-Sep-10 22:51 
QuestionCalendarExtender popup appearing when Enter key is pressed. Pin
dev_asp_shreshtha6-Sep-10 0:48
dev_asp_shreshtha6-Sep-10 0:48 
AnswerRe: CalendarExtender popup appearing when Enter key is pressed. Pin
dan!sh 6-Sep-10 0:59
professional dan!sh 6-Sep-10 0:59 
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 
The List(T) class is neither covariant nor contravariant.

Here is why:

If you have a list of class A, you can't cast it to a list of class B (derived from A), because not all instances of class A are also instances of class B. This is obvious.

Now the other way: why is it impossible to cast a list of clas B (derived from A) to a list of class A? Because then you could add an item of class C (derived from A) to the list, although it is actually a list of B.


If you only need to iterate throught all the items (thus the full list can be read-only), then you can create a custom iteration logic by implementing the IEnumerable(T) and IEnumerator(T) interfaces, that's probably what I would do... Instead of adding a new List(A) to the class, create a method that returns IEnumerable(A) and implement the iteration logic.
GeneralRe: Need help with co/contravariance and generic lists :s [modified] Pin
Lee Reid6-Sep-10 0:41
Lee Reid6-Sep-10 0:41 

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.