Avatar of pratikshahse
pratikshahse

asked on 

search inside collection

I have an array with multiple items in it.  I want to pull a value of an item from the array where specific items value is "X"

so here is what I want
Collection Items
         collection.Item(0).StateAlpha = 'AR'
         collection.Item(0).PolicyType = P
         collection.Item(0).HasAClaim = N
         collection.Item(0).HasAClaimThisMod  = N
         collection.Item(0).SearchStatus  = P
         collection.Item(0).Mod = 2

         collection.Item(1).StateAlpha = 'AZ'
         collection.Item(1).PolicyType = P
         collection.Item(1).HasAClaim = N
         collection.Item(1).HasAClaimThisMod  = N
         collection.Item(1).SearchStatus  = P
         collection.Item(1).Mod = 3

and so on ......

this is what i want to do

string x = get me the value from collection where Mod = 3
.NET Programming

Avatar of undefined
Last Comment
it_saige
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Please show how you define the collection in your program and how the item which is stored in it is defined?
Avatar of pratikshahse
pratikshahse

ASKER

my collection is defined in a seperate class. basically I read a value out of DB and populate the collection
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

If it is your own collection class then you will have to code the search function yourself.  

Consider using one of the collections (eg. map, list...) provided by the .net framework.  They support functions such as Find where you can pass a delegate to a function that can check if the item meets the criteria supplied.  There are examples in the help files.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo