How do I pass a 'null' action
Pass in an empty action if you want to:
DoExport((x, y) => { })
Second, you have to review your code, since passing in null
is perfectly fine.
public void X()
{
A(null);
}
public void A(Action<ColumnView, bool> a)
{
if (a != null)
{
a();
}
}
Or as per C# 6 (using the null-propagation operator):
public void A(Action<ColumnView, bool> a)
{
a?.Invoke();
}
Or just handle it inside of the method:
private void DoExport(Action<ColumnView, bool> UpdateColumns)
{
if (UpdateColumns != null)
UpdateColumns(...);
}
You can pass an action that does nothing:
DoExport((_, __) => { });