Copy Strings

G

Guest

Since a String is a reference type, it would not be a copy, simply a change
in references. At the end s1 and s2 point to the same place in memory. If
you want a copy, then make a copy - that's why the Copy method exists.

Since it's simply moving a reference it's thread safe.
 
T

tony

Hi ,

if i have

string s1="s1";
string s2="s2";

when copy the strings

s1=s2;

1. is this action equals String.Copy ?
2. is this action is thread safe ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top