destroying object and changing variables with collisions in c#

Good day,
I have been searching for a while about how to destroy an object if it collides with another.
Basically, the game I am trying to make involves the player object shooting waves of enemies coming down (It’s a very unoriginal idea, but hopefully one to learn from).
However, the only c# tutorial I found has the object destroyed if it collides with anything, but barely explains what’s happening.
So how would I go about writing a c# script that destroys the player if it collides with an enemy, and stops the wave?

Thanks in advance!

In the OnCollisionEnter function of the player’s controlling MonoBehaviour you want to test the layer or tag of the GameObject of the collider sent in to verify that it is an enemy. If it is just call Destroy on the player’s GameObject. You’ll need to make sure to either tag the enemies as such or assign them to an enemy layer depending on what method you use.

I see, I think I get the theory behind that, but how would it be coded?