Advice for how best to adapt a Python habit to C#
(This is code for a Game of Life board's
The way I used to do this in Python is as shown, I would pass a float into a method, but in the method I'd check first that the float wasn't a string, in which case I'd act differently. I could obviously do this by setting percentage as a var or object, and checking it can be cast to different types, but I'm curious to know what's best practice here. Can I do something with overloads? Optional parameters? I'm still very new to this.
Populate method, that aims to create a 2D array of tiles based on a percentage living rate, or entered pattern)The way I used to do this in Python is as shown, I would pass a float into a method, but in the method I'd check first that the float wasn't a string, in which case I'd act differently. I could obviously do this by setting percentage as a var or object, and checking it can be cast to different types, but I'm curious to know what's best practice here. Can I do something with overloads? Optional parameters? I'm still very new to this.
