Hacker News new | ask | show | jobs
by danek 4491 days ago
Structural typing would be nice. My wish would be algebraic data types. I'm not sure how that would even work in c# but its what I want :)

I tend to avoid using out parameters. I've written extension methods to replace the typical out param framework methods.. For example, instead of int.parse(string s, out int i), we have "123".TryParse<int>(), which returns a nullable int. instead of TryGetValue on dictionary, we have GetOrDefault(key, optional default val) and GetOrDefaultAsNullable(key).

I think the new out parameter syntax is an improvement, but I'm still on the fence about whether out parameters are even a good idea when we can instead return a single type that encodes the same information.

I'd be interested in hearing other viewpoints on this.