4 ms·
C# 8 also has nullable reference types, i.e. comprehensive nullability analysis, which is comparable though not identical to an option type. I really wish for e
by jolux 7y ago
C# 8 also has nullable reference types, i.e. comprehensive nullability analysis, which is comparable though not identical to an option type. I really wish for exhaustive pattern matching and ADTs in C#, though.
- alkonaut 7y agoIt always feels a bit half baked when the class library isn’t designed with it though. It would be as if generics were added but not System.Collections.Generic. So while I long thought it would be the perfect addition to C#, I’m not so enthusiastic any more. It would be great (F# is!) but not as good as it would be in a language and platform where it was there all along. In F# this is already an issue when you want to use Option/Result but as soon as you do anything with the BCL you need to handle exceptions instead, and convert to/from error cases of ADTs.
- DaiPlusPlus 7y agoI’m surprised there isn’t an F# feature that automatically wraps a call with a try/catch wrapper that returns an Option<T,TException> - something like that could be done in a library, right?
- hermitdev 7y ago> It would be as if generics were added but not System.Collections.Generic I started with C# in the 1.0 days before generics. The lack of strongly typed collections was very annoying with all of the casts involved. I used to use a template engine/code generator to create strongly typed collections. Can't remember the name of the tool... Probably been since 2002 or 2003 since I used it.
- jen20 7y agoCodesmith?
- Merad 7y agoNullable reference types also feel pretty half baked with EF at the moment. If you have a non-nullable column that you want to represent with a non-nullable property in your EF model, pretty much the only option (the last time I looked) was to configure EF to use a nullable private field and access it through a non-nullable public property. It's a lot of extra work.
- deleted 7y ago[deleted]
- invrmkaccounts 7y agoThis will get fixed in due time: >What will Microsoft do? >We will also aim to be done with null-annotating our core libraries when .NET 5 (November 2020) comes around – and we are currently on track to do so. [1] [2] [1] https://devblogs.microsoft.com/dotnet/embracing-nullable-reference-types/ https://devblogs.microsoft.com/dotnet/embracing-nullable-ref... [2] https://github.com/dotnet/runtime/issues/2339 https://github.com/dotnet/runtime/issues/2339