Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Useless function

Useless function

Scheduled Pinned Locked Moved The Weird and The Wonderful
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    musefan
    wrote on last edited by
    #1

    A common one in this forum is functions used that don't actually do anything. Well here is one I have just found too... public static bool ToBoolean(bool value); ...forget where I seen this now :laugh: (no wonder it is seen so often, people obviously read too much documentation lol) PS. I am assuming most no exactly where I found this Convertion function

    return 5;

    OriginalGriffO R F 3 Replies Last reply
    0
    • M musefan

      A common one in this forum is functions used that don't actually do anything. Well here is one I have just found too... public static bool ToBoolean(bool value); ...forget where I seen this now :laugh: (no wonder it is seen so often, people obviously read too much documentation lol) PS. I am assuming most no exactly where I found this Convertion function

      return 5;

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      It not really a horror, is it? It does say it does no conversion in MSDN[^] I would say it is just there to complete the set: Convert.ToInt32 and so forth are there too.

      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      M 1 Reply Last reply
      0
      • M musefan

        A common one in this forum is functions used that don't actually do anything. Well here is one I have just found too... public static bool ToBoolean(bool value); ...forget where I seen this now :laugh: (no wonder it is seen so often, people obviously read too much documentation lol) PS. I am assuming most no exactly where I found this Convertion function

        return 5;

        R Offline
        R Offline
        RobCroll
        wrote on last edited by
        #3

        Actually very handy if you are passing a object type which has an underlying value of type bool. Good code should always be strongly typed but maybe when dealing with COM objects, this overloaded method could be handy.

        M 1 Reply Last reply
        0
        • M musefan

          A common one in this forum is functions used that don't actually do anything. Well here is one I have just found too... public static bool ToBoolean(bool value); ...forget where I seen this now :laugh: (no wonder it is seen so often, people obviously read too much documentation lol) PS. I am assuming most no exactly where I found this Convertion function

          return 5;

          F Offline
          F Offline
          fjdiewornncalwe
          wrote on last edited by
          #4

          For those who desperately need self-validation.

          I wasn't, now I am, then I won't be anymore.

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            It not really a horror, is it? It does say it does no conversion in MSDN[^] I would say it is just there to complete the set: Convert.ToInt32 and so forth are there too.

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

            M Offline
            M Offline
            musefan
            wrote on last edited by
            #5

            As I said. People post these 'Do Nothing' functions all the time. I was simple pointing this one out as these are obviously OK if MS says so

            return 5;

            1 Reply Last reply
            0
            • R RobCroll

              Actually very handy if you are passing a object type which has an underlying value of type bool. Good code should always be strongly typed but maybe when dealing with COM objects, this overloaded method could be handy.

              M Offline
              M Offline
              musefan
              wrote on last edited by
              #6

              Robert Croll wrote:

              Actually very handy if you are passing a object type which has an underlying value of type bool

              But this specific function does not take an object. It takes a bool and returns a bool. Just wasted code in any usage

              return 5;

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups