views:

16

answers:

1

Hello Friends,

I have this code

 viewModel.Messages = repository.GetAllMessages().OrderBy(x => x.MessageText);

with this I am getting 75 messges and i am displaying all the Messages in the Grid with two columns

MessageText and MessageType

But I need to write a Linq Query to get all my Distinct MessageTypes from Messages?

Can any body help me out?

thanks

+3  A: 
repository.GetAllMessages().Select(m => m.MessageType).Distinct();
Ian Henry