windows phone 7 - Saving a custom object using IsloatedStorageSettings -


i'm trying save object in isolatedstoragesettings save high scores game, whenever try save updated copy of object c# seems think object hasn't changed. tried creating custom equals function highscores class doesn't seem help.

any idea i'm doing wrong?

thanks

public bool addorupdatevalue(string key, object value) {     bool valuechanged = false;      // if key exists     if (isolatedstore.contains(key))     {         // if value has changed         if (isolatedstore[key] != value) //this keeps returning false         {             // store new value             isolatedstore[key] = value;             valuechanged = true;         }     }     // otherwise create key.     else     {         isolatedstore.add(key, value);         valuechanged = true;     }      return valuechanged; }    //this located inside highscores class     public bool equals(highscores newhighscores) {     (int = 0; < highscores.length; i++)     {         if (!highscores[i].name.equals(newhighscores.getindex(i).name))         {             return false;         }          if (!highscores[i].time.equals(newhighscores.getindex(i).time))         {             return false;         }     }      return true; } 

you haven't implemented equality operators '==' , '!=' , these compare reference equality, going have provide implementation maps on 'equals' method

http://msdn.microsoft.com/en-us/library/ms173147%28v=vs.80%29.aspx


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -