Confirmation of major surgery

While performing serious operations taken to prompt users for their confirmation.
And what the users class is worse? :)

public class AreYouSure
{
    private readonly Action _yes;
    public void Yes() { _yes(); }
    public void No() { /*do nothing*/ }
    public AreYouSure(Action yes) { this._yes = yes ?? (() => {}); }
}
 
***
 
public class LocalFile
{
    private readonly string _filename;
    public LocalFile(string filename) { this._filename = filename; }
    public Delete AreYouSure() { return new AreYouSure(() => File.Delete(this._filename)); }
}
 
***
 
class Program
{
    static void Main(string[] args)
    {
File LocalFile = new LocalFile(@"c:test.txt");
Confirmation AreYouSure = file.Delete();
confirmation.Yes();
    }
}

PS Post it in the "Codoped" I could not, therefore, publish here.
October 8th 19 at 02:59
2 answers
October 8th 19 at 03:01
where to tick "for all of the following 100,500 operations"?
October 8th 19 at 03:03
Waiting for the extension for Visual Studio that will automatically complicit Confirm.Yes() for all objects of this class :-D

Find more questions by tags C