0

I am filling a datatable in my windows application. The data table looks like this

date           product
aug 2010       ABC-1
aug 2010       XYZ-1
aug 2010       MNO-2
aug 2010       WOR-4
sep 2010       XYZ-2
sep 2010       RES-3
sep 2010       WOR-4

I want to display a message box in this format

aug 2010 - ABC-1,XYZ-1........
sep 2010 - XYZ-2,RES-3.........

Only the first 2 products for each month should be displayed rest should be truncated for each month.

I hope I have explained my problem clearly.

1
  • How far have you got already? It will be easier to help if people can see where you are up to. Commented Sep 27, 2010 at 18:52

1 Answer 1

1
from dp in DateProducts
group dp.Product on dp.Date in g
select
{
    g.Key.ToString() 
          + " - " 
          + String.Join(",", g.Take(2).ToArray()) 
          + g.Count() > 2 ? "......." : ""
}
Sign up to request clarification or add additional context in comments.

1 Comment

hi, iam working on 2.0 framework.Is there any other way that i can do it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.