Eliminate LINQ for List<int> ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Eliminate LINQ for List<int> ?

  1. #1
    Join Date
    Sep 2007
    Posts
    300

    Eliminate LINQ for List<int> ?

    I have the example below, I want to cancel LINQ how to write ?
    Code:
    static void Main()
        {
            List<int> list = new List<int>();
            list.Add(7);
            list.Add(11);
            list.Add(13);
            // See if any elements with values greater than 10 exist.
            bool exists = list.Exists(element => element > 10);
            Console.WriteLine(exists);
            // Check for numbers less than 7.
            exists = list.Exists(element => element < 7);
            Console.WriteLine(exists);
        }

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,651

    Re: Eliminate LINQ for List<int> ?

    Loop through the items with a foreach loop and compare each item. When you find an item that meets the criteria, set the flag and break.

  3. #3
    Join Date
    Sep 2007
    Posts
    300

    Re: Eliminate LINQ for List<int> ?

    thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)