I have been spinning my wheels on this one for days!

Trying to add the `MainWindowTitle` of a specific currently running processes by process name, in this example "notepad", to a ListView. I have figured out how to create and add the item, but now I have duplicates in my ListView. So what I'm trying to do is only add an item to my ListView if it doesn't already exist as an exact item on my ListView.

Relevant information:

-There will be multiple of the same processes that I am trying to capture the MainWindowTitle from (from 1 to 9) but they will each have a unique ID.

-Each MainWindowTitle will be different

Here's what I have so far, I can't make LINQ work and I'm not sure if there would be a way to make a foreach loop to prevent duplicates.

I appreciate any help!

```
Process[] processList = Process.GetProcessesByName("notepad");
    foreach (Process process in processList)
    {
        ListViewItem item = new ListViewItem();
        item.Content = process.MainWindowTitle;
        item.Tag = process;

        if (listView.Items.Contains(item))
        {
            MessageBox.Show("Duplicate");
        }
        else
        {
            MessageBox.Show("New Item!");
            listView.Items.Add(item);
        }

```

Edit 1: Still adding duplicate items

```
        Process[] processList = Process.GetProcessesByName("notepad");
        foreach (Process process in processList)
        {
            ListViewItem item = new ListViewItem();
            item.Content = process.MainWindowTitle;

            item.DataContext = process;

            var itemz = listView.Items.Cast<ListViewItem>().ToList().Where(x => x.DataContext == process);

            if (listView.Items.Contains(itemz))
            {
                MessageBox.Show("Duplicate");
            }
            else
            {
                MessageBox.Show("New Item!");
                listView.Items.Add(item);
            }

```

Edit2: Closer, I hope, still adding duplicates

```
        Process[] processList = Process.GetProcessesByName("notepad");
        foreach (Process process in processList)
        {
            ListViewItem item = new ListViewItem();
            item.Content = process.MainWindowTitle;

            item.DataContext = process;

            var itemz = listView.Items.Cast<ListViewItem>().ToList().Where(x => (x.DataContext as Process).Id == process.Id);

            if (itemz == null)
            {
                MessageBox.Show("Duplicate");
            }
            else
            {
                MessageBox.Show("New Item!");
                listView.Items.Add(item);
            }
        }

```