Default parameter in C# 4

Simple overload:

overload1

 

Now let’s do this with a default property:


public partial class SettingsForm : XtraForm
{
public bool ShowRestartRequiredMessage { get; set; }

public SettingsForm(bool showRestartRequiredMessage = false)
{
InitializeComponent();
ShowRestartRequiredMessage = showRestartRequiredMessage;
}

We don’t need an overload anymore but nothing changed on the usage of the class

overload3

 

Cheers!