Skip to content

Wrong assumption about slow ValueType.Equals method #20954

@jinek

Description

@jinek

The article says:

The System.ValueType implementation of Equals uses reflection because it must be able to determine what the fields are in any struct.

But if we look at the code:
image
We can see, that it does bitwise comparison if all fields are also value types.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions