how to check if string from textbox exists in db

Code Example - how to check if string from textbox exists in db

                
                        // Check for duplicates
bool isDuplicate = ExistingList.Any(r => r.Name == textBox.Name);

 if (isDuplicate)
            {
                MessageBox.Show("Name already Exists");
                return;
            }