How to detect a function pointer type?

Viewed 196

Is there a way to detect the function pointer type for a field?

The C# 9 compiler accepts the following code:

unsafe class Foo
{   
    public delegate*<string, int> functionPointer = &GetLength;

    static int GetLength(string s) => s.Length;
}

What I've discovered so far using the reflection:

  • the field type is IntPtr
  • no custom attributes are applied to the field
  • no custom modifiers are applied to the field
0 Answers
Related