Topic List | Page List: 1 |
---|---|
Topic | Cool function I wrote |
Magus 10 10/05/18 2:35:08 AM #21: | Sahuagin posted... one use for ref would be maybe if you had a counter that you wanted to pass between methods. then you can share the counter between a bunch of methods and increment it in any one of them. but then you can just put it in an object, too, which is better, so it's not super useful. Yeah, I'm not sure I'd really want to pass around state like that specifically. I suppose the Interlocked methods are one example where it's pretty necessary, but I don't think most people are going to need to be implementing that particular set of methods. Sahuagin posted... the standard example is something like: Yeah, multiple returns is the scenario I was thinking about with tuples being another option, although I suppose in the case where you're checking an error return value then out params are probably a little easier to use. --- Internet = Tube0 + Tube1X + Tube2X^2/2! + Tube3X^3/3! + Tube4X^4/4! + ... ... Copied to Clipboard! |
Topic List | Page List: 1 |