First time question for me :)
I need some way to define a default predicate using a generic on the format
Func<T, bool>
and then use this as a default argument. Something like this:
public bool Broadcast(byte command, MemoryStream data, bool async, Func<T, bool> predicate = (T t) => true)
When i do this i get the compile error:
Default parameter value for 'predicate' must be a compile-time constant
Is there a smooth way of doing this that I am missing or should a make the predicate function nullable and change my function logic accordingly?
Thanks,
See Question&Answers more detail:os