CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007
    Posts
    405

    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 / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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
    405

    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
  •  





Click Here to Expand Forum to Full Width

Featured