|
TO: static void StringConvert (string str)
{
str = "string being converted.";
}
static void Main ()
{
string str1 = "str";
StringConvert (str1);
.....
Is such that:
string str1 = "str";
Executing this sentence allocates an address in memory, puts it into "str", and points to it by str1 ...
After calling StringConvert (str1) ;, str points to str1, which is the address where "str" is located, but there is such a code in the method: str = "string being converted."; At this time, another space will be opened in memory "string being converted.", and it is pointed to by str, but at this time str1 still points to "str" and has not changed ..
This is my understanding ... for reference only ... |
|