Distinct Query in LINQ

Last post 07-03-2009 8:32 PM by malcolms. 1 replies.

Sort Posts:

  • Distinct Query in LINQ

    07-03-2009, 2:01 PM

     Hi all,

    I have a requirement to write a query using LINQ, to fetch distinct values from a list (with repeated primary key values). The other field values in the list (with non redundant data) for the corresponding primary key value, should be shown as comma seperated values. Is there any option in LINQ for this issue.

  • Re: Distinct Query in LINQ

    07-03-2009, 8:32 PM
    Answer
    • Star
      12,555 point Star
    • malcolms
    • Member since 06-12-2008, 12:38 AM
    • Melbourne, Australia
    • Posts 2,061

    You can use the Distinct method with LINQ queries.  Like this:

    var query = (from p in Customers
                      select p).Distinct();


    Sincerely,
    Malcolm Sheridan

    Microsoft Certified Solution Developer
    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as
    Answer" if a marked post does not actually answer your question.
Page 1 of 1 (2 items)