c# - Different objects but same value? -


i have problem when tried change of value.

list<reflanguage> languages1 = _reflanguageservice.getall(); list<reflanguage> languages2 = languages1; languages1.where(x => x.id == 1).tolist().foreach(x => x.name = "turkish"); boolean issame = languages1.equals(languages2); 

the first line getting reflanguage records using ef.

when execute code, value of issame object true.

the line list<reflanguage> languages2 = languages1; points reference of languages1 same memory languages2. .equals method compare 2 references, in case same.

what instead can compare is

bool issame = languages1.sequenceequal(languages2); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -