Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Collections Help when in a parent class

Reply
 
Old 05-15-2008   #1 (permalink)
scott ocamb


 
 

Collections Help when in a parent class

All,

I have a Form Class, shown below that will have a collection of Question
objects.

The Question Class has an Approve method.

When any single Question is approved, I need to know if all Questions in the
Collection in the Form are approved.

A single Question does not know about the collection it is part of in the
form.

Any impelemtation suggestions would be appreciated.

public class Form

{

private List<Question> _questions = new List<Question>();

}





My System SpecsSystem Spec
Old 05-17-2008   #2 (permalink)
Cor Ligthert[MVP]


 
 

Re: Collections Help when in a parent class

scott,

That is exactly for what the for and foreach methods are.

You can use Linq as well to select all not approved questions and if that
returns null you know that it is done.

(I would use a simple foreach in this case, behind the scene it will be sure
be used by Linq)

Cor

"scott ocamb" <socamb@xxxxxx> schreef in bericht
news:uz37qCvtIHA.1220@xxxxxx
Quote:

> All,
>
> I have a Form Class, shown below that will have a collection of Question
> objects.
>
> The Question Class has an Approve method.
>
> When any single Question is approved, I need to know if all Questions in
> the Collection in the Form are approved.
>
> A single Question does not know about the collection it is part of in the
> form.
>
> Any impelemtation suggestions would be appreciated.
>
> public class Form
>
> {
>
> private List<Question> _questions = new List<Question>();
>
> }
>
>
>
>
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
When a class is both an inherited class of another, and alsoimplements an interface method .NET General
represent XML in classes/collections (C#) .NET General
System.Collections.Generic.List<int> myList = new System.Collections.Generic.List<int>(100); .NET General
Generics and collections .NET General
Confused getting properties of Collections of one vs. many PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46