Which kind of method signature do you prefer and why?
Posted
by devoured elysium
on Stack Overflow
See other posts from Stack Overflow
or by devoured elysium
Published on 2010-05-12T16:18:30Z
Indexed on
2010/05/12
16:24 UTC
Read the original article
Hit count: 202
Ok, this is probably highly subjective but here it comes:
Let's assume I'm writing a method that will take a printscreen of some region of the screen. Which method signature would you prefer and why?
- Bitmap DoPrintScreen(int x, int y, int width, int height);
- Bitmap DoPrintScreen(Rectangle rect);
- Bitmap DoPrintScreen(Point point, Size size);
- Other
Why?
I keep seeing myself repeatedly implementing both 1) and 2) (redirecting one of them to the other) but I end up usually just using one of them, so there really is no point in having both. I can't decide which would be better. Maybe I should use the signature that looks the most with the method I'll be calling to make the printscreen?
© Stack Overflow or respective owner