if object is destroyed

hello :smiley: So i need C# code that detect if my target(selectedTarget) is destroyed :smiley:

if this is Transform type, so simple

if (selectedTarget) { ... }

this becomes false after object is destroyed

not work for me O.o

if (selectedTarget) {

}

else
{
TargetEnemy();
GetComponent().target = selectedTarget;
GetComponent().target = selectedTarget;
}

whats wrong with that script??