Interview questions about a temporary object

The following code will cause some temporary objects?
string a = new string("abc");
a = (a.ToUpperCase() + "123").SubString(0,2);

Started by Myron at February 03, 2016 - 4:59 PM

One hundred million! Identification finished! Can be submitted to your 50 year old C# compilation of part-time teacher~~~

Posted by Valentine at February 18, 2016 - 5:42 PM

Posted by Ritchie at February 21, 2016 - 5:59 PM

. . . What is the significance of wrestling with these things

The interviewer asked these questions, estimation techniques are not where to go, although I don't know how much a temporary object.. Visual inspection is 6

Posted by Edgar at February 26, 2016 - 6:59 PM

Visual inspection 4
1 new a
2 ToUpperCase return a
3 major a
4 SubString and a

Posted by Winfred at November 17, 2016 - 12:40 PM

Wave sleeve, walk out of the room.

Posted by Brenda at November 20, 2016 - 1:07 PM

5 do

Posted by Randall at December 05, 2016 - 1:09 PM

These problems know again how? Don't know and will produce what effect on the project?

Posted by Sarah at December 12, 2016 - 1:58 PM

6 identification finished.

Posted by Ivan at December 26, 2016 - 2:51 PM

3.
1: a.ToUpperCase();
2: a.ToUpperCase() + "123";
3: (a.ToUpperCase() + "123").SubString(0,2);

Posted by Gavin at January 10, 2017 - 3:03 PM

Are you sure you write is the C# code?

Posted by Neil at January 10, 2017 - 4:00 PM

4:a
5:"123"
6:"abc"

Posted by Ivan at January 11, 2017 - 4:08 PM

1.string a = new string("abc");
2.a.ToUpperCase()
3.a.ToUpperCase() + "123"
4.(a.ToUpperCase() + "123").SubString(0,2);

Don't know "123" is not a temporary variables, in my memory seems to direct the compiler compiler text constant static constants

This kind of problem is the value of the test have to know the allocation of memory than the heart don't assign a strong memory so little~
And then write program memory saving will save little~
Garbage collection will reduce the bit~

Posted by Ward at January 13, 2017 - 4:37 PM