How do make an object appear and disappear after t seconds?

I want to make an object appear on collision, wait for a couple of seconds and make it disappear again.

public class TriggerObject : MonoBehaviour {

    public GameObject object;

    void OnTriggerEnter(Collider other)
    {
        object.SetActive(true);
        // Wait for a second
        object.SetActive(false);

    }
}

I have no idea how to make this to wait for a second…
I didn’t figure out how to build in “yield WaitForSeconds(1);”.
Is there any function which can solve my problem or is there any other way to solve this?

You can only use WaitForSeconds() inside a Coroutine.

 void OnTriggerEnter(Collider other)
 {
   StartCoroutine( ShowAndHide(object, 1.0f) ); // 1 second
 }

 IEnumerator ShowAndHide( GameObject go, float delay )
 {
   go.SetActive(true);
   yield return new WaitForSeconds(delay);
   go.SetActive(false);
 }