Hash codes to detect change RRS feed

  • Question

  • I would like to create a hashcode to store in a database, so later I will know if a different object representing the same set of conditions, has changed.

    This object has five integers, one string and one bool.

     The flow is this.

    1.  Initialize object

    2.  Test against DB value

    3.  Take action if there is a change as indicated by the DB value.

    4. repeat with next object.

    I would then like to test against  hash codes in the database and know if I need to take action, because something has changed.

    I am looking for links that explain how to use hash codes in this sort of situation,.


    • Edited by danielsn Thursday, April 26, 2018 11:05 PM
    Thursday, April 26, 2018 10:33 PM


All replies

  • Please rephrase your question.. cause it's not really clear what you want. Do you want to create an appropriate hash or know how to proceed in such an situation.
    Friday, April 27, 2018 12:01 AM
  • Hello danielsn,

    >>I am looking for links that explain how to use hash codes in this sort of situation.

    Maybe you could take reference with the MSDN document and also you could override custom GetHashcode method and compare value between them.

    Best Regards,

    Neil Hu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Marked as answer by danielsn Friday, April 27, 2018 2:15 PM
    Friday, April 27, 2018 6:10 AM
  • It turns out I have to write a custom unique value, if I want to persist it, as Microsoft documentation says not to persist hash values.  (Though larger ones like "SHA-1" might be an exception.)
    Friday, April 27, 2018 3:44 PM