3 ms·
> If I'd have candidates that want out from .NET I'd be very intrigued and want to know why. Every time I change jobs I always try. It's not that I hate .Net,
by gwbas1c 5y ago
> If I'd have candidates that want out from .NET I'd be very intrigued and want to know why.
Every time I change jobs I always try. It's not that I hate .Net, it's just that I want to try something different.
.Net is awesome, but it's always useful to see how other languages and platforms do things. For example, compiler enforced null checking in C# is lousy compared to Swift or Rust.
- starik36 5y agoIn .NET 6, there is new "EnableNullable" directive that will do that. It's on by default for new projects.
- gwbas1c 5y agoIt's horrible. For example, it treats Linq's .First() as nullable. (.First() throws an exception, .FirstOrDefault() returns null.) Type.Name is also treated as nullable. I didn't encounter any issues like that when I tried Swift and Rust.
- Genbox 5y agoThat is not true. LINQ's First() correctly returns a non-nullable type: https://source.dot.net/#System.Linq/System/Linq/First.cs,11 https://source.dot.net/#System.Linq/System/Linq/First.cs,11 FirstOrDefault() correctly returns a nullable type: https://source.dot.net/#System.Linq/System/Linq/First.cs,33 https://source.dot.net/#System.Linq/System/Linq/First.cs,33 typeof(type).Name is MemberInfo.Name, which is also not nullable: https://source.dot.net/#System.Private.CoreLib/MemberInfo.cs,14 https://source.dot.net/#System.Private.CoreLib/MemberInfo.cs... I checked both .NET 5 and .NET 6. They have identical nullability.
- gwbas1c 5y agoThen how come I get a compiler error if I don't check the result?
- int_19h 5y agoDid you perhaps enable null checking for an older version of the framework (in which the standard assemblies don't have the appropriate annotations)? This works just fine when targeting .NET 6: object[] xs = {}; var n = xs.First(); n.ToString();
- hvidgaard 5y agoThat is a very valid reason.