I have this function:
public static void SetSettingFlag(string name, ParamViewModel[] array, SET s)
{
foreach (var setting in array)
{
if (setting.Name == name)
{
setting.IsSelected = true;
App.DB.UpdateIntSetting(s, setting.Id);
}
else
setting.IsSelected = false;
}
}
public enum SET
{
ABtn = 0,
BBtn = 1,
CBtn = 2
}
Is there a way to change this so the parameter s is optional and so if it is not supplied then the App.DB.Update
will not be executed?
For reference SET is an enum.
Here's how I would like to call the method:
Utils.SetSettingFlag(name, vm.PTI, SET.Pti);
or
Utils.SetSettingFlag(name, vm.PTI);