Answer:
Every virus is different.
Some are infectious for only a couple of days; some are infectious until after your body has been buried. Some may be infectious for longer than that; bodies of the victims of the 1917 influenza strain have recently been exhumed, and were discovered to STILL be dangerous.