Visual Studio: reset user settings when debugging

前端 未结 6 1009
深忆病人
深忆病人 2020-12-24 07:29

In a C# Winforms-App I have several user settings stored.

Is there an easy way to clear those settings each time I start debugging the project from Visual Studio 200

6条回答
  •  离开以前
    2020-12-24 07:53

    Had the same question and found an answer here: https://stackoverflow.com/a/2117359/488794

    Properties.Settings.Default.Reset()
    

    You can use this following statement to only reset if you're debugging:

    if(Debugger.IsAttached) 
       Settings.Default.Reset();
    

    tested VS2012 .Net 4.0 (Reference)

提交回复
热议问题