Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

How to avoid copying the reference in linq C#

$
0
0

Hi All,

I have following queries - 

  currObject = (from obj in objectEntity.parts
                       where obj.pKey.Equals(cKey)
                       select obj).FirstOrDefault();

  newObject = (from obj in objectEntity.parts
                       where obj.pKey.Equals(cKey)
                       select obj).FirstOrDefault();

 Here both above linqs are same. If I used -

 newObject = currObject

 It will copy the reference which I don't want. I want both the object independent on each other using 1 query.

Please help me.



Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>