Windows Vista Forums

Collections Help when in a parent class

  1. #1


    scott ocamb Guest

    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

  2. #2


    Cor Ligthert[MVP] Guest

    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

    > 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

Collections Help when in a parent class

Similar Threads
Thread Forum
Moving from class C to class B ip address scheme, any tips(DC/DNS)
We are about to migrate away from a class C ip structure (192.168.100.x) to class B (http://www.subnet-calculator.com/subnet.php?net_class=B) I...
Server General
When a class is both an inherited class of another, and alsoimplements an interface method
The code below doesn't compile (after I added ": IComparable" on the first line). Any advice on how to get it compiled? public class...
.NET General
Icon libraries or collections
Would like to update some of my own application icons with Vista-like icons. Anyone know of good repositories to get icons from? Thanks.
Vista General
System.Collections.Generic.List<int> myList = new System.Collections.Generic.List<int>(100);
System.Collections.Generic.List<int> myList = new System.Collections.Generic.List<int>(100); Does this preallocate 100 integers? Also, is...
.NET General
Generics and collections
I do not know if what I am trying to do is impossible, however since I cannot work out how to do it I thought I would post it here in the hope of...
.NET General
Confused getting properties of Collections of one vs. many
Hi- I am confused about the behaviour of a collection with a single element vs. the behaviour of a collection with multiple elements. If I have...
PowerShell
How to serialize the Generic collections in WCF
i am having a service that need to return a generic list<> of type my custom class. but when i create client proxy, the list was treated as array....
Indigo