---
title: "How to use Except keyword in linq query."  
description: "How to use Except keyword in linq query."  
author: "Anonymous User"  
published: 2016-01-21  
updated: 2016-01-21  
canonical: https://www.mindstick.com/forum/33910/how-to-use-except-keyword-in-linq-query  
category: "linq"  
tags: ["c#", "linq"]  
reading_time: 1 minute  

---

# How to use Except keyword in linq query.

I want to use [Except](https://www.mindstick.com/blog/144/union-intersection-and-except-operator-in-sql-server) [keyword in linq](https://www.mindstick.com/forum/33909/how-to-use-let-keyword-in-linq-query-mvc-entity-framework) query. How to do this please help me.

## Replies

### Reply by Anonymous User

The Except() method requires two collections.\
One collection on which Except method invoked and second collection which is passed as a parameter.\
The Except method returns the elements from first collection which do not exist parameter in the second collection.

```
using System;using System.Collections.Generic;using System.Data.Entity;using System.Linq;namespace program{    class Example    {        public static void Main()        {            IList<string> List1 = new List<string>() { "aditya", "manoj", "kavita", "komal", "vimal" };            IList<string> List2 = new List<string>() { "aditya", "sohel", "vimal", "mayank", "mohit" };            var result = List1.Except(List2);            Console.BackgroundColor = ConsoleColor.Red;            Console.ForegroundColor = ConsoleColor.White;            foreach (string str in result)                Console.WriteLine(str);            Console.Read();        }    }}
```

![How to use Except keyword in linq query.](https://www.mindstick.com/mindstickforums/be125f1a-f7d8-477e-b030-e05425435e5f/images/580c0e08-52fa-49d1-b03f-e216618241c6.png)


---

Original Source: https://www.mindstick.com/forum/33910/how-to-use-except-keyword-in-linq-query

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
