Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
QuestionHow to drag the panel on the form? Pin
Sokka9321-Nov-08 9:41
Sokka9321-Nov-08 9:41 
AnswerRe: How to drag the panel on the form? Pin
Ennis Ray Lynch, Jr.21-Nov-08 9:56
Ennis Ray Lynch, Jr.21-Nov-08 9:56 
GeneralRe: How to drag the panel on the form? Pin
Sokka9322-Nov-08 7:56
Sokka9322-Nov-08 7:56 
QuestionC# GridView Pin
Marywe21-Nov-08 9:07
Marywe21-Nov-08 9:07 
AnswerRe: C# GridView Pin
J$21-Nov-08 9:38
J$21-Nov-08 9:38 
Question'List' help ? Pin
nlowdon21-Nov-08 7:45
nlowdon21-Nov-08 7:45 
AnswerRe: 'List' help ? Pin
Pedram Behroozi21-Nov-08 8:10
Pedram Behroozi21-Nov-08 8:10 
AnswerRe: 'List' help ? Pin
Christian Graus21-Nov-08 8:56
protectorChristian Graus21-Nov-08 8:56 
If you need to tell which animals are of what type to do something specific with them, then your inheritance tree is probably broken. You can add methods like GetAllCats, tho. Then you can do this:

foreach(Animal animal in newAnimals)
{
Cat c = animal as Cat;
if (c != null)
{
// Add c to a list to return, or do something with c
}
}

The as keyword attempts to cast an object as a derived object, and returns null if it fails.

I would also use a list instead of an array, so you can add as many animals as you like, unless your class requires you to use arrays at this point.

If you just mean accessing the objects, then newAnimals[0], newAnimals[1] is how you reference them.

Christian Graus

Driven to the arms of OSX by Vista.

GeneralRe: 'List' help ? Pin
nlowdon21-Nov-08 9:20
nlowdon21-Nov-08 9:20 
GeneralRe: 'List' help ? Pin
Christian Graus21-Nov-08 10:33
protectorChristian Graus21-Nov-08 10:33 
GeneralRe: 'List' help ? Pin
nlowdon21-Nov-08 12:35
nlowdon21-Nov-08 12:35 
GeneralRe: 'List' help ? Pin
User 665821-Nov-08 13:14
User 665821-Nov-08 13:14 
GeneralRe: 'List' help ? [modified] Pin
cor287921-Nov-08 13:31
cor287921-Nov-08 13:31 
GeneralRe: 'List' help ? Pin
Christian Graus21-Nov-08 20:54
protectorChristian Graus21-Nov-08 20:54 
QuestionDefining form client area Pin
Chris Copeland21-Nov-08 5:12
mveChris Copeland21-Nov-08 5:12 
AnswerRe: Defining form client area Pin
Rob Smiley21-Nov-08 6:03
Rob Smiley21-Nov-08 6:03 
GeneralRe: Defining form client area Pin
Chris Copeland21-Nov-08 6:17
mveChris Copeland21-Nov-08 6:17 
Questionthe efficieny consideration Pin
Seraph_summer21-Nov-08 3:28
Seraph_summer21-Nov-08 3:28 
AnswerRe: the efficieny consideration Pin
Ennis Ray Lynch, Jr.21-Nov-08 3:34
Ennis Ray Lynch, Jr.21-Nov-08 3:34 
QuestionForm Paint drawing incorrectly Pin
Chris Copeland21-Nov-08 3:14
mveChris Copeland21-Nov-08 3:14 
AnswerRe: Form Paint drawing incorrectly Pin
Ennis Ray Lynch, Jr.21-Nov-08 3:35
Ennis Ray Lynch, Jr.21-Nov-08 3:35 
GeneralRe: Form Paint drawing incorrectly Pin
Chris Copeland21-Nov-08 3:49
mveChris Copeland21-Nov-08 3:49 
GeneralRe: Form Paint drawing incorrectly Pin
Ennis Ray Lynch, Jr.21-Nov-08 3:57
Ennis Ray Lynch, Jr.21-Nov-08 3:57 
GeneralRe: Form Paint drawing incorrectly Pin
Chris Copeland21-Nov-08 4:07
mveChris Copeland21-Nov-08 4:07 
GeneralRe: Form Paint drawing incorrectly Pin
Guffa21-Nov-08 5:01
Guffa21-Nov-08 5:01 

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.