Click here to Skip to main content
15,902,923 members
Home / Discussions / C#
   

C#

 
AnswerRe: Xml Navigation question plz Help Pin
Stefan Troschuetz10-Feb-07 20:20
Stefan Troschuetz10-Feb-07 20:20 
QuestionReturnig parametrs from sql statment Pin
microuser_200010-Feb-07 11:30
microuser_200010-Feb-07 11:30 
AnswerRe: Returnig parametrs from sql statment Pin
Christian Graus10-Feb-07 11:46
protectorChristian Graus10-Feb-07 11:46 
Questionforeach Pin
ali_reza_zareian10-Feb-07 10:50
ali_reza_zareian10-Feb-07 10:50 
AnswerRe: foreach Pin
Christian Graus10-Feb-07 10:59
protectorChristian Graus10-Feb-07 10:59 
AnswerRe: foreach Pin
Luc Pattyn10-Feb-07 11:01
sitebuilderLuc Pattyn10-Feb-07 11:01 
GeneralRe: foreach Pin
ali_reza_zareian10-Feb-07 11:12
ali_reza_zareian10-Feb-07 11:12 
GeneralRe: foreach Pin
Luc Pattyn10-Feb-07 11:21
sitebuilderLuc Pattyn10-Feb-07 11:21 
Hi,

foreach insists on matching types, all elements your enumerator offers must match the
type you mention inside foreach (or be derived from it), hence my Person suggestion
(although object would do too !).

I am not absolutely sure about generics, but I expect exactly the same:
in a teacher collection you can put teachers;
in a persons collection you can put teachers and students, but enumerating them would
result in persons, hence teachers as well as students.

If you insist on having different types (Student and Teacher) in a single collection,
then I strongly suggest you use the "as" statements I showed before. It works
very well for me.

Smile | :)

Luc Pattyn

GeneralRe: foreach Pin
ali_reza_zareian10-Feb-07 11:35
ali_reza_zareian10-Feb-07 11:35 
AnswerRe: foreach Pin
DavidNohejl10-Feb-07 11:04
DavidNohejl10-Feb-07 11:04 
GeneralRe: foreach Pin
PIEBALDconsult10-Feb-07 15:12
mvePIEBALDconsult10-Feb-07 15:12 
QuestionConvert Image to Bitmap Pin
max2929710-Feb-07 10:15
max2929710-Feb-07 10:15 
AnswerRe: Convert Image to Bitmap Pin
mav.northwind10-Feb-07 10:34
mav.northwind10-Feb-07 10:34 
AnswerRe: Convert Image to Bitmap Pin
Stefan Troschuetz10-Feb-07 10:37
Stefan Troschuetz10-Feb-07 10:37 
AnswerRe: Convert Image to Bitmap Pin
Luc Pattyn10-Feb-07 10:42
sitebuilderLuc Pattyn10-Feb-07 10:42 
AnswerRe: Convert Image to Bitmap Pin
Christian Graus10-Feb-07 10:43
protectorChristian Graus10-Feb-07 10:43 
GeneralRe: Convert Image to Bitmap Pin
Guffa10-Feb-07 11:12
Guffa10-Feb-07 11:12 
GeneralRe: Convert Image to Bitmap Pin
Christian Graus10-Feb-07 11:44
protectorChristian Graus10-Feb-07 11:44 
GeneralRe: Convert Image to Bitmap Pin
Stefan Troschuetz10-Feb-07 20:32
Stefan Troschuetz10-Feb-07 20:32 
GeneralRe: Convert Image to Bitmap Pin
Guffa11-Feb-07 0:10
Guffa11-Feb-07 0:10 
GeneralRe: Convert Image to Bitmap Pin
Stefan Troschuetz11-Feb-07 0:24
Stefan Troschuetz11-Feb-07 0:24 
GeneralRe: Convert Image to Bitmap Pin
Guffa11-Feb-07 11:27
Guffa11-Feb-07 11:27 
AnswerRe: Convert Image to Bitmap Pin
ali_reza_zareian10-Feb-07 10:55
ali_reza_zareian10-Feb-07 10:55 
GeneralRe: Convert Image to Bitmap Pin
Christian Graus10-Feb-07 11:00
protectorChristian Graus10-Feb-07 11:00 
GeneralRe: Convert Image to Bitmap Pin
ali_reza_zareian10-Feb-07 11:19
ali_reza_zareian10-Feb-07 11:19 

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.