D
Dylan Parry
Hi,
Say I have an array of objects of type "Person" (ie. Person[]) and each
Person object in the array has a property "Name" (ie. Person.Name), is
there a simple way of telling whether an object exists in the array that
has a specific value for the Name property?
This is what I want to do in pseudo-code:
----
Person[] people = myGetPeopleArrayMethod();
if (people.ContainsAPersonWithNameEquals("Fred"))
{
Person myPerson = people.GetThePersonWithName("Fred");
// Do things with "Fred"
...
}
----
Is there a simple way to do the above? I don't necessarily want to
create all of those methods listed above, in fact if it can be done in
fewer steps, that would be even better.
Cheers,
--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk
The opinions stated above are not necessarily representative of
those of my cats. All opinions expressed are entirely your own.
Say I have an array of objects of type "Person" (ie. Person[]) and each
Person object in the array has a property "Name" (ie. Person.Name), is
there a simple way of telling whether an object exists in the array that
has a specific value for the Name property?
This is what I want to do in pseudo-code:
----
Person[] people = myGetPeopleArrayMethod();
if (people.ContainsAPersonWithNameEquals("Fred"))
{
Person myPerson = people.GetThePersonWithName("Fred");
// Do things with "Fred"
...
}
----
Is there a simple way to do the above? I don't necessarily want to
create all of those methods listed above, in fact if it can be done in
fewer steps, that would be even better.
Cheers,
--
Dylan Parry
http://electricfreedom.org | http://webpageworkshop.co.uk
The opinions stated above are not necessarily representative of
those of my cats. All opinions expressed are entirely your own.