cmartinbot wrote:
You should read about value types vs. reference types in dotnet. Here is a good page I found with google:
http://www.knowdotnet.com/articles/referencetypes2.html
Yeah, I've done a fair amount of reading. This article was really good: Parameter passing in C# (http://www.yoda.arachsys.com/csharp/parameters.html).
Initially I was confused because I was thinking that you could only pass by reference when explicitly using the ref or out notations and I was confused how my entities were changing without the notations. However, in the article above, this section seems to apply to the LLBL Gen entities:
Remember though that the value of a reference type variable is the reference - if two reference type variables refer to the same object, then changes to the data in that object will be seen via both variables.
In their given example for this section:
void Foo (StringBuilder x)
{
x.Append (" world");
}
StringBuilder y = new StringBuilder();
y.Append ("hello");
Foo (y);
Console.WriteLine (y);
the output is:
hello world
which appears to be the way the LLBL entities work.
Knowing more about it now, and knowing that there are probably lots of other people not aware of the subtle differences, it seems that more people are lucky that they don't run into 'mysterious' issues on why their objects keep changing on them.
Thanks for listening!