You must Sign In to post a response.
  • Category: LINQ

    Problem in using Lambda Expressions

    Hi all,

    I have a problem and need help to address this urgent requirement.

    The data in the database table resembles like the one as below

    ID Name
    1001 john
    1002 davis
    1003 name
    1002 name
    1001 johny
    1003 mani
    1003 ganesh

    I need to show the string in the table like below using c# linq

    ID Name
    1001 John, johny
    1002 Davis, name
    1003 Name, mani, ganesh


    1001 = john, Johnny
    1002 = davis, name
    1003 = name, mani, ganesh

    Any kind of solution to this problem is greatly appreciated.

    Thanks in advance.


  • #653547
    static void Main(string[] args)
    List<string> lstOne =
    new List<string>() { "Jack", "Henry", "Amy" };
    List<string> lstTwo =
    new List<string>() { "Hill", "Amy", "Anna" };
    IEnumerable<string> lstNew = null;
    // Concatenate Unique Elements of two List<string>
    lstNew = lstOne.Concat(lstTwo).Distinct().OrderBy(x => x);

    static void PrintList(IEnumerable<string> str)
    foreach (var s in str)
    foreach (var num in arr.OfType<int>().Where(x => x = s))

  • #653586
    Sql Query

    select Field1,
    ( select (', ' + a2.Field2)
    from table a2
    where a1.Field1 = a2.Field1
    order by
    Field1,Field2 for xml path('')), 3, 1000)
    from table a1
    group by Field1


    For linq quer refer to this link

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.