dotnet / dotnet/Silk.NET

Extent2D and Extent3D should implement IEquatable

Open
#2,276 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
5.2k
Forks
477
Avg merge
3d 16h
Merged PRs (30d)
2

Description

# Summary of feature
Silk.NET.Vulkan.Extent2D and Silk.NET.Vulkan.Extent3D should implement IEquatable.

# Comments

There might be other structs that would benefit from the implementation.

In my code I'm comparing 2 Silk.NET.Vulkan.Extent2D with `currentSize.Equals(displaySize)` to check if some resources should be recreated.
As a workaround i changed my code to compare the individual fields.

Output from resharper code inspection:
```
warning: Struct 'Extent2D' is checked for equality using the inefficient runtime-provided implementation
Default implementations of the 'Equals' and 'GetHashCode' methods of a struct are reflection-based and bad-performing
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.