Brian said:
Thanks. I was wondering if there was a commonly accepted term for
that. "Temporary" makes sense to me.
There isn't really any specific term for ut, it's just an object. The
object is the same regardless if you have one variable containing a
reference to it, ten variables containing a reference to it, or zero
variables containing a reference to it.
It's quite common to have short-lived objects that aren't referenced by
a variable. For an example look at the statement:
string x = "There are " + items + " items in " + pages + " pages.";
There is a lot of "anonymous" objects here:
The literal strings "There are ", " items in " and " pages." are
constants in the assembly, but the don't have any names.
The values from the variables items and pages (asuming that they are
integers) are copied and boxed inside objects, which doesn't have any names.
There is an object array that is created to hold the references of the
literal strings and the boxed values, which doesn't have a name.
The object array is sent to string.Concat, and the only surviving object
is the final string. It's reference is stored in the variable.