How to get all Types using LINQ in Asp.net mvc
I have this code
viewModel.Messages = repository.GetAllMes开发者_Go百科sages().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
repository.GetAllMessages().Select(m => m.MessageType).Distinct();
精彩评论