1

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

1 Answer 1

3
repository.GetAllMessages().Select(m => m.MessageType).Distinct();
Sign up to request clarification or add additional context in comments.

Comments

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.