dotnet / dotnet/dotnet-api-docs
Modreq usage of `UnmanagedType` type should be documented
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
**Issue description**
The code following C# code
```cs
public void UnmanagedT() where T : unmanaged { }
```
generates the following IL code:
```cil
.method public hidebysig
instance void UnmanagedT () cil managed
{
.param type T
.custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = (
01 00 00 00
)
.maxstack 8
IL_0000: ret
}
```
which expect any compilers wanting to use the method to know that the type parameter T has to meet certain requirements.
With the `System.Runtime.CompilerServices.IsVolatile` type it is documented how & what the modreq does, it should be the same here. It would also be good if `System.Runtime.CompilerServices.IsExternalInit` (and any others missing it) got the same documentation.
I'm looking on https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedtype?view=net-6.0.
**Target framework**
- [x] .NET Core 1.0+
- [x] .NET Framework 1.1+
- [x] .NET Standard 1.1+
Contributor guide
Assessment
This issue has not been assessed yet.