DEV Community

Discussion on: C# Tip: How to temporarily change the CurrentCulture

Collapse
 
polterguy profile image
Thomas Hansen

Najs one! :)

You can generalise the above pattern, by further providing two Action arguments, to the CTOR of a class called e.g. Executor, resulting in generalised deterministic execution of code, the same way you'd use destructors in C#. I once create an HTML renderer using such tricks :)

It becomes a bit tricky as you start having code that might throw exceptions, etc - But still a nice way to achieve "deterministic execution" ... :)