c# - Why I receive different reference on assign? -


i have following piece of code , don't understand why have 2 different references.

dictionary<string, myclass> tempdictionary = new dictionary<string, myclass>(); myclass dbclass = db.get<myclass>().first(); myclass localclass = null;  if(!tempdictionary.trygetvalue(dbclass.id, out localclass)) {     tempdictionary.add(localclass.id, localclass = dbclass); // <-- notice assignment (localclass = dbclass) }  var localref = localclass.gethashcode();  // 90107424 var dbref = dbclass.gethashcode();   // 91823173 

why references different? shouldn't point same object?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -