Click here to Skip to main content
15,882,209 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago29-Feb-24 8:00
Peter Moore - Chicago29-Feb-24 8:00 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
PIEBALDconsult29-Feb-24 8:26
mvePIEBALDconsult29-Feb-24 8:26 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago29-Feb-24 8:45
Peter Moore - Chicago29-Feb-24 8:45 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
haughtonomous1-Mar-24 1:05
haughtonomous1-Mar-24 1:05 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
PIEBALDconsult1-Mar-24 4:47
mvePIEBALDconsult1-Mar-24 4:47 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
dandy7229-Feb-24 5:31
dandy7229-Feb-24 5:31 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
OriginalGriff29-Feb-24 6:03
mveOriginalGriff29-Feb-24 6:03 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Richard Deeming29-Feb-24 6:04
mveRichard Deeming29-Feb-24 6:04 
There are certainly some odd decisions in the .NET class libraries. But I don't agree with you on this one. From a purely logical perspective, checking whether all members of an empty set satisfy a particular condition should always return true - there are no members which don't satisfy the condition, so returning false would be senseless.

If you want an example of a nonsensical decision, look no further than the System.Text.Json.JsonElement's TryGet... methods, which will throw an exception if the "JSON type" of the element is wrong.

So TryGetInt64 will return true for { "id": 42 }; return false for { "id": 3.1415 }; and throw an exception for { "id": "42" }. WTF | :WTF:

Given the usual TryParse pattern, you might expect these methods to return false for any invalid input. But that's not what they do. They return false for some kinds of invalid input, and throw an exception for other kinds of invalid input.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago29-Feb-24 8:02
Peter Moore - Chicago29-Feb-24 8:02 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Richard Deeming29-Feb-24 21:27
mveRichard Deeming29-Feb-24 21:27 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
theoldfool29-Feb-24 23:36
professionaltheoldfool29-Feb-24 23:36 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago1-Mar-24 2:39
Peter Moore - Chicago1-Mar-24 2:39 
JokeRe: .NET's Sometimes Nonsensical Logic Pin
Richard Deeming3-Mar-24 21:22
mveRichard Deeming3-Mar-24 21:22 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago29-Feb-24 8:03
Peter Moore - Chicago29-Feb-24 8:03 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
haughtonomous1-Mar-24 1:10
haughtonomous1-Mar-24 1:10 
GeneralRe: .NET's Sometimes Nonsensical Logic - Platoon version Pin
David On Life1-Mar-24 9:52
David On Life1-Mar-24 9:52 
GeneralRe: .NET's Sometimes Nonsensical Logic - Platoon version Pin
haughtonomous27-Mar-24 21:58
haughtonomous27-Mar-24 21:58 
GeneralRe: .NET's Sometimes Nonsensical Logic - Platoon version Pin
David On Life28-Mar-24 7:56
David On Life28-Mar-24 7:56 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Peter Moore - Chicago29-Feb-24 8:10
Peter Moore - Chicago29-Feb-24 8:10 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
Thomas Daniels29-Feb-24 10:36
mentorThomas Daniels29-Feb-24 10:36 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
jmaida29-Feb-24 12:06
jmaida29-Feb-24 12:06 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
jschell29-Feb-24 12:42
jschell29-Feb-24 12:42 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
jmaida29-Feb-24 14:35
jmaida29-Feb-24 14:35 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
jschell1-Mar-24 11:51
jschell1-Mar-24 11:51 
GeneralRe: .NET's Sometimes Nonsensical Logic Pin
jmaida1-Mar-24 15:04
jmaida1-Mar-24 15:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.