This is related to conventions used in C#.
I've got a method that has two parameters (X and Y coordinates). These coordinates represent the position at which a "tile" may reside. If a tile resides at these coordinates, the method returns its number. If no tile resides at these coordinates, I'm wondering how the method should behave.
I see three options:
So, what should I do?
You can return null, and check for this on the calling code.
Of course you'd have to use a nullable type:
int? i = YourMethodHere(x, y);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With