Click here to Skip to main content
15,915,509 members
Home / Discussions / C#
   

C#

 
QuestionUpdate Data Table from Data Source Pin
polishprogrammer3-Dec-08 5:03
polishprogrammer3-Dec-08 5:03 
AnswerRe: Update Data Table from Data Source Pin
Wendelius3-Dec-08 11:04
mentorWendelius3-Dec-08 11:04 
GeneralRe: Update Data Table from Data Source Pin
polishprogrammer4-Dec-08 3:51
polishprogrammer4-Dec-08 3:51 
GeneralRe: Update Data Table from Data Source Pin
Wendelius4-Dec-08 4:10
mentorWendelius4-Dec-08 4:10 
QuestionExtracting List Objects Pin
nlowdon3-Dec-08 4:37
nlowdon3-Dec-08 4:37 
AnswerRe: Extracting List Objects Pin
J4amieC3-Dec-08 5:09
J4amieC3-Dec-08 5:09 
AnswerRe: Extracting List Objects [modified] Pin
Thomas Weller3-Dec-08 5:15
Thomas Weller3-Dec-08 5:15 
AnswerRe: Extracting List Objects Pin
moon_stick3-Dec-08 5:20
moon_stick3-Dec-08 5:20 
Not really - because OfType<T> takes a specific type you can't interchange between Dog and Cat unless they share some common type (other than 'Animal' which I'm assuming is your base type).

My preference would be that Cat and Dog both implement an IPet interface:

<br />
internal interface IPet<br />
{<br />
    void Pet();<br />
}<br />


so that when you're doing your look you call

<br />
foreach (IPet pet in zooAnimals.Oftype<ipet>())<br />
{<br />
   pet.Pet();<br />
}<br />
</ipet>


FWIW, I assume you're using yield return in your OfType<t> - it's more efficient than creating an intermediary IEnumerable object to store the results before returning them?
HTH

It definitely isn't definatley

GeneralRe: Extracting List Objects Pin
J4amieC3-Dec-08 5:29
J4amieC3-Dec-08 5:29 
JokeRe: Extracting List Objects Pin
moon_stick3-Dec-08 5:32
moon_stick3-Dec-08 5:32 
AnswerRe: Extracting List Objects Pin
Guffa3-Dec-08 5:28
Guffa3-Dec-08 5:28 
QuestionExpose Objects through Remoting with Windows services Pin
MarkPhB3-Dec-08 2:24
MarkPhB3-Dec-08 2:24 
AnswerRe: Expose Objects through Remoting with Windows services Pin
Jimmanuel3-Dec-08 4:09
Jimmanuel3-Dec-08 4:09 
QuestionHammersley Sampling Pin
GAbirkan3-Dec-08 0:55
GAbirkan3-Dec-08 0:55 
AnswerRe: Hammersley Sampling Pin
Alan Balkany3-Dec-08 4:15
Alan Balkany3-Dec-08 4:15 
QuestionHomography Question Pin
VincentOng2-Dec-08 23:49
VincentOng2-Dec-08 23:49 
AnswerRe: Homography Question Pin
User 66582-Dec-08 23:54
User 66582-Dec-08 23:54 
GeneralRe: Homography Question Pin
VincentOng3-Dec-08 0:00
VincentOng3-Dec-08 0:00 
GeneralRe: Homography Question Pin
User 66583-Dec-08 0:16
User 66583-Dec-08 0:16 
GeneralRe: Homography Question Pin
VincentOng3-Dec-08 0:34
VincentOng3-Dec-08 0:34 
GeneralRe: Homography Question Pin
User 66583-Dec-08 0:56
User 66583-Dec-08 0:56 
GeneralRe: Homography Question Pin
Luc Pattyn3-Dec-08 1:06
sitebuilderLuc Pattyn3-Dec-08 1:06 
GeneralRe: Homography Question Pin
VincentOng3-Dec-08 1:08
VincentOng3-Dec-08 1:08 
GeneralRe: Homography Question Pin
Luc Pattyn3-Dec-08 1:30
sitebuilderLuc Pattyn3-Dec-08 1:30 
GeneralRe: Homography Question Pin
Christian Graus4-Dec-08 8:17
protectorChristian Graus4-Dec-08 8:17 

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.