Closed
Description
Type of issue
Other (describe below)
Description
The article attributes the fact that ReferenceEquals=false to the fact that a structure was copied, however it's not true - it will always return false, even in both examples (in which clearly no copy is involved); so it shouldn't be attributed to the fact of copying, but rather due to boxing ;)
public struct A
{
}
public class Assertions
{
internal static A A1 = new A();
public void Y()
{
Console.WriteLine(object.ReferenceEquals(A1, A1));
Lol(ref A1);
}
private void Lol(ref A a)
{
Console.WriteLine(object.ReferenceEquals(A1, a));
}
}
Page URL
Content source URL
Document Version Independent Id
b8e7e74e-d529-2397-a121-2cb7618a6cac
Article author
Metadata
- ID: abfb3769-16f2-70c8-8b66-5fa0a11354c0
- Service: dotnet-csharp
- Sub-service: fundamentals