Access to Modified Closure (2)

Prior to C# 5, you need to re-declare a variable inside the foreach – otherwise it is shared, and all your handlers will use the last string: foreach (string list in lists) { string tmp = list; Button btn = new Button(); btn.Click += new EventHandler(delegate { MessageBox.Show(tmp); }); } Significantly, note that from C# …

Read more

Do I need to maintain ReSharper’s dotsettings.user file in Source Control?

No, the dotSettings.user file should be excluded from source control. It has user specific information in it, and shouldn’t be shared, e.g. bookmarks, unit test session windows. The .dotSettings contains project or solution specific settings that can be shared with the team, e.g. naming standards or braces layout. If you wish to share these amongst …

Read more