"Dereference" var in C#
- by chris12892
I have some code in C# that uses a structure as such:
ArrayList addrs = new ArrayList();
byte[] addr = new byte[8];
while (oneWire.Search_GetNextDevice(addr))
{
addrs.Add(addr);
}
In this example, every element in the ArrayList is the same as the last device that was found because it would appear as though addr is passed out by reference and I am simply copying that reference into the ArrayList.
Is there any way to "Dereference" addr to only extract it's value?
It's also possible my assessment of the situation is incorrect, if that appears to be the case, please let me know
Thanks!