by woodrowbarlow · 6y ago · 0 comments
> graphics.DrawRectangle(RedBrush, new Point(3, 5, 2, 2))
what's the advantage of the first example? i prefer the second, because i don't have to look at the definition of DrawRectangle in order to know that the second argument is a 'Point' object.
new List<KeyValuePair<string,int>> { new (“a”, 1), new (“b”, 2) }
versus having to barf out the type name for every element will be REALLY nice.
It's still nice to have the option in cases where it improves readability (maybe with named args or sth)
Saves some typing but it also has refactor implications too. If you change the parameter type, it would change the object being constructed.