• Registered (unregistered)

    Not great code, but not too damaging to have an exception unless it is invoked millions of times in a loop.

    public static bool IsFrist(string theValue) { try { Convert.ToOrdinal(theValue); return true; } catch { return false; } }

  • (nodebb)

    Too bad double.TryParse() is around for 25 years since .net BETA.

    Feels to me like yet another RTFM situation, most likely from someone coming from Java since this person doesn't even know the basic value types of .net - something most C# devs learn like on the first day - and therefore used such a weird name for that useless method.

  • (nodebb) in reply to Registered

    What's Convert.ToOrdinal() ?

    That method never existed on the Convert class of .net.

    And the correct answer is as stated in the article: https://learn.microsoft.com/en-us/dotnet/api/system.double.tryparse?view=net-9.0

  • Richard Brantley (unregistered)

    "...pedantry is the root of clarity"

    A large portion of my career has just been vindicated! :)

  • Toasty (unregistered)

    Telling that simple verification functions like this should be built into .net without all the intellectual drama devs inject into their code. We've got 170IQ devs who write code like function()=>Foo.New(a => ^Bar(1).First().Flarg(a.Color) (goes on for another 256 characters) ...then Dev:"Look at this...I turn the label Blue!". Me: "Why not just turn the label blue? Wouldn't that be simple?" Dev: "Pffft...simple is relative....look at this code!!!"

  • Argle (unregistered) in reply to Registered

    I got the joke even if MaxiTB didn't.

  • (nodebb) in reply to Argle

    So did I, but, ToOrdinal() will also return true for secnod and thrid.

    Addendum 2025-05-12 10:18: and FileNotFound for brillant.

    Addendum 2025-05-12 10:19: s/ToOrdinal/isFrist/

    ToOrdinal() won't throw an exception for the other cases is what I meant to say.

  • (nodebb) in reply to Argle

    Enlighten me :-)

  • Klimax (unregistered) in reply to MaxiTB

    I'd think IsFrist would be dead give away...

Leave a comment on “Would a Function by Any Other Name Still be WTF?”

Log In or post as a guest

Replying to comment #680054:

« Return to Article