Search code examples
c#pointersaliasusing

Alias to pointer (byte*) in C#


Is it possible to make an alias on unsafe pointer type, i.e. I wanna use following: using bytePtr = System.Byte*.

Will .net developers introduce this feature in future versions (alias to pointer and array types)?


Solution

  • No, it isn't.

    And if it was, the syntax would have been:

    using BytePtr = System.Byte*;
    

    but again: no, you can't do that. A using alias can not be to a pointer.

    Also, byte* is both shorter and clearer than BytePtr, IMO.