by dustinmoris · 7y ago · 0 comments
This is why most C# developers would use an interface for this. With an interface you add extra parameters or dependencies to the constructor of the concrete implementation. If this example wasn't sort algorithms but password hashing algorithms this would be clear.
So yeah.. it proves my point... writing good C# is not that easy, requires a lot of experience and mistakes before someone knows how to write SOLID code in C#. Thanks for helping my point!
void List<int> Sort(List<int> input, bool someParam){}
var values = new List<int> { 9, 1, 5, 7 };
DoSomething(x => Sort(x, true), values);
Thanks for proving my point that you really don't know C#.Because your F# example is the same except it's trading Func<List<int>, List<int> for (int list -> int list)
Func<T[], T[]> where T : IComparable<T>
But maybe all of that is just stronger arguments for F#'s inferred typing...