Washi1337/AsmResolver

Ref struct type flag

Closed this issue · 1 comments

JPaja commented

Problem Description

new ref Struct have special custom attribute called "IsRefLike" that differentiate them from normal structs
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-7.2/span-safety#metadata-representation-of-ref-like-structs

Additionally System.Type has property called IsByRefLike which indicates ref struct
https://learn.microsoft.com/en-us/dotnet/api/system.type.isbyreflike?view=net-6.0

Proposal

Add Property called "IsRefLike" or "IsByRefLike" that checks if IsRefLike attribute is present on certain Type

Alternatives

No response

Additional Context

No response

Adding a IsByRefLike property would make the most sense to me, to stay consistent with other APIs.

It can probably be implemented in a similar fashion as the IsReadOnly property (See TypeDefinition.cs#L497).

We could maybe include this in the upcoming 5.0.0 release as well.