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. General Programming
  3. C#
  4. identityHashCode

identityHashCode

Scheduled Pinned Locked Moved C#
csharpjavaquestion
5 Posts 3 Posters 1 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.
  • D Offline
    D Offline
    DwR
    wrote on last edited by
    #1

    Hi, Does anyone know of a direct C# equivalent, or implementation, of java's System.identiyHashCode method? Regards, Dave

    Regards, Dave

    G M 2 Replies Last reply
    0
    • D DwR

      Hi, Does anyone know of a direct C# equivalent, or implementation, of java's System.identiyHashCode method? Regards, Dave

      Regards, Dave

      G Offline
      G Offline
      Green Fuze
      wrote on last edited by
      #2

      maybe it is object.GetHashCode ???

      D 1 Reply Last reply
      0
      • G Green Fuze

        maybe it is object.GetHashCode ???

        D Offline
        D Offline
        DwR
        wrote on last edited by
        #3

        That's "an" answer but I don't think it's "the" answer. The rason is that some objects override their base hashcode. And in this case it's the base hashcode that's needed. That's what the Java class returns, if I understand it corrctly. Regards, Dave

        Regards, Dave

        G 1 Reply Last reply
        0
        • D DwR

          That's "an" answer but I don't think it's "the" answer. The rason is that some objects override their base hashcode. And in this case it's the base hashcode that's needed. That's what the Java class returns, if I understand it corrctly. Regards, Dave

          Regards, Dave

          G Offline
          G Offline
          Green Fuze
          wrote on last edited by
          #4

          did you try to cast that object to "object" and than use that code?

          object wctohc = new WeirdClassThatOverridesHashCode();
          wctohc.HashCode(); // ta-da! :)

          1 Reply Last reply
          0
          • D DwR

            Hi, Does anyone know of a direct C# equivalent, or implementation, of java's System.identiyHashCode method? Regards, Dave

            Regards, Dave

            M Offline
            M Offline
            Mike Nakis
            wrote on last edited by
            #5

            System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode( obj );

            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