using System; namespace Semmle.Util { /// /// An instance of this class is used to ensure that the provided /// action is executed only once and on the first call to `Run`. /// It is thread-safe. /// public class Initializer { private readonly Lazy doInit; public Initializer(Action action) { doInit = new Lazy(() => { action(); return true; }); } public void Run() { _ = doInit.Value; } } }