473,322 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

find by index in Generics

Hi,

I created a generics list:
List<FileViewupdatedfilesArr =
(List<FileView>)DataListFiles.DataSource;

and I would like to find an item in the list according to a given
index of the item in the list.

Is there a simple way to achieve it ?
Thanks so much.

Ruthie.

May 13 '07 #1
3 9885
On May 13, 12:37 pm, ruthie <ruthie...@yahoo.comwrote:
Hi,

I created a generics list:
List<FileViewupdatedfilesArr =
(List<FileView>)DataListFiles.DataSource;

and I would like to find an item in the list according to a given
index of the item in the list.

Is there a simple way to achieve it ?

Thanks so much.

Ruthie.
Hi Ruthie,

You can use the index operator of the list.

updatedfilesArr[index]

If that's not what you meant, feel free to ask :).

Moty

May 13 '07 #2
On May 13, 12:52 pm, Moty Michaely <Moty...@gmail.comwrote:
On May 13, 12:37 pm, ruthie <ruthie...@yahoo.comwrote:
Hi,
I created a generics list:
List<FileViewupdatedfilesArr =
(List<FileView>)DataListFiles.DataSource;
and I would like to find an item in the list according to a given
index of the item in the list.
Is there a simple way to achieve it ?
Thanks so much.
Ruthie.

Hi Ruthie,

You can use the index operator of the list.

updatedfilesArr[index]

If that's not what you meant, feel free to ask :).

Moty

Dear Moty,

Great !!

So simple - I spent some time for looking for something much
complicated.

Thanks a lot.

Ruthie.

May 13 '07 #3
On May 13, 1:41 pm, ruthie <ruthie...@yahoo.comwrote:
On May 13, 12:52 pm, Moty Michaely <Moty...@gmail.comwrote:
On May 13, 12:37 pm, ruthie <ruthie...@yahoo.comwrote:
Hi,
I created a generics list:
List<FileViewupdatedfilesArr =
(List<FileView>)DataListFiles.DataSource;
and I would like to find an item in the list according to a given
index of the item in the list.
Is there a simple way to achieve it ?
Thanks so much.
Ruthie.
Hi Ruthie,
You can use the index operator of the list.
updatedfilesArr[index]
If that's not what you meant, feel free to ask :).
Moty

Dear Moty,

Great !!

So simple - I spent some time for looking for something much
complicated.

Thanks a lot.

Ruthie.
Hi,

Glad I could help.

The List class has much more search capabilities such as FindIndex and
more Find* methods.

You can look for further information (here of course:) ) and the MSDN
generic list page:
http://msdn2.microsoft.com/en-us/library/d9hw1as6.aspx

Moty

May 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Sean Berry | last post by:
Given myList = what is the easiest way to find out what index 'dog' is at?
4
by: salem.ganzhorn | last post by:
#include <map> #include <iostream> using namespace std; int main( int argc, const char * argv ) {
11
by: ike | last post by:
Could you please give your opinion on the portability of this code? /* -------- begin findindex.c -------- */ struct Foo { int junk0; }; struct Bar { int junk1; struct Foo foo; int junk2; }; ...
8
by: mike | last post by:
what should i have to write in this code section? #### is what i want to write do i have to use foreach to for if options is TextBox array i used to enumbera....... but i don't...
10
by: cmrhema | last post by:
hello I am working in asp.net and C# I am selecting multiple items in a list box. Now I want a count of the seleted items also the index of the selected item I browsed and found something...
2
by: GS | last post by:
I want to create a dropdownlistbox in my windows form with name value pair. but I need to initialize its initial selected value to a value from database for the record. I was going to just use...
1
by: Lorna | last post by:
I have a table on a form containing 2 columns - size type and size. Depending on the size type (Mens, womens, Youth) I want to change the set of sizes available (in an option box). I have been able...
5
by: zcabeli | last post by:
Hello, how can i find the index of an existing element in a list ? thanks,
4
by: raylopez99 | last post by:
I would like to know if there's a quick "Linq" way to find the index of an array having a particular value. I can do this the long way by sequential iteration, but would like to know if there's a...
6
by: ashiela | last post by:
i need to find the max position of my program. how can i do that? int main() { int j,max=0,k; for(k=0;k<=9;k++) { printf("Enter the number:"); scanf("%d", &j); }
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.