the act of doing (...)

Addressing less directly

sometimes, referring to people/pronouns directly is not preferred. make it less direct with こと.

✕ 私を避けていたんだ。 too direct
○ 私のことを避けていたんだ。 nicely indirect

The thing of (...)

~ないことはない but

very commonly seen phrase. Meaning is literally as you'd expect "It is not that the thing is not this, but..."

映画は見ないことはないが、詳しくもない。 It's not that I don't watch movies, but I just don't know too much about them.

in 危ない, this is a bit of a deceptive case as it's not ない negative.

ここは危ないことはないけど、気を付けて方がいい It's not that this place is dangerous, but it's better to be careful.

納豆は食べられないことはないけど、自分から買って食べようとは思わない。 It's not that I can't eat natto, but I don't think that I will buy it for myself to eat.

https://bunpro.jp/grammar_points/ないことはない

Emphasising

不思議なことに、最近物事がすべてうまくいく。
驚いたことに、6ヶ月で赤ちゃんが初めて歩いた。

Command

こと + copula (だ・です). Describes a weak command.

面倒臭くても、朝御飯を食べることだ。 No matter how much of a drag it is, you have to eat breakfast.

何があっても、時間通りに来ることだ。 No matter what happens, you have to come at this time.

どんなに疲れていても、諦めてないことだ。 No matter how tired you are, you should not give up.