-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
api-needs-workAPI needs work before it is approved, it is NOT ready for implementationAPI needs work before it is approved, it is NOT ready for implementationarea-System.Runtime
Milestone
Description
C# doesn't support pointer operations on generic types. We can, however, express them in IL. A prototype could like this:
public static class Unsafe
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static T Read<T>(void * p)
{
// Can't be expressed in C#, thus in IL:
ldarg.0
ldobj !!T
ret
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Write<T>(void * p, T value)
{
// Can't be expressed in C#, thus in IL:
ldarg.0
ldarg.1
stobj !!T
ret
}
}This would also solve issues like #16026 without any additional work.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-needs-workAPI needs work before it is approved, it is NOT ready for implementationAPI needs work before it is approved, it is NOT ready for implementationarea-System.Runtime