none
How to get item exist on for each when number of element more than 2000 item ? RRS feed

  • Question

  • Problem

    How to get item exist on for each when number of element more than 2000 item ?

    when put breakpoints to asslstab I found it have 2000 item

    i need to search specific item as FrmNews on asslstab that have 2000 without waiting for 2000 iteration loop

     foreach (Assembly asm in asslstTab)
     {
     }

    so that are there are any thing on debug that allow to me get specific item i need to check 

    without waiting for debug 2000 iteration ?

    Tuesday, March 12, 2019 1:24 AM

Answers

  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 15, 2019 5:12 AM
    Moderator

All replies

  • i need to search specific item as FrmNews on asslstab that have 2000 without waiting for 2000 iteration loop

    >> I need to search item inside a big collection, without iterating the whole collection.

    Possible solutions:

    1- Count on lucky! Maybe, it is the first one...

    2- Implement a binary search.

    3- Start searching on an index you know is near and rite below, or near and rite above the target item.

    4- Keep a list of indexes of special items, and search this list instead.

    5- etc...

    Tuesday, March 12, 2019 3:43 AM
  • Hi, engahmedbarbary,

    Thank you for posting here.

    According to your description, you want to search a specific item as FrmNews on asslstab without waiting for debug 2000 iteration.

    You could set the if the sentence in the loop, please try the following example code.

    foreach (Assembly asm in asslstTab)
    
    {
    
      If(asm. FullName.Contains(“some text”))
    
    {
    
    //do some action
    
    }
    
    }


    Hope my advice could be helpful.

    Best regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, March 12, 2019 6:15 AM
    Moderator
  • Also consider a HashSet<Assembly> collection for your asslstTab variable and use the Contains function.

    Or give details about FrmNews and your specific searches.

    • Edited by Viorel_MVP Tuesday, March 12, 2019 6:28 AM
    Tuesday, March 12, 2019 6:24 AM
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 15, 2019 5:12 AM
    Moderator