When to use pointers in C#/.NET?

后端 未结 5 664
自闭症患者
自闭症患者 2020-12-02 07:16

I know C# gives the programmer the ability to access, use pointers in an unsafe context. But When is this needed?

At what circumstances, using pointers becomes inevi

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 07:48

    Say you want to communicate between 2 application using IPC (shared memory) then you can marshal the data to memory and pass this data pointer to the other application via windows messaging or something. At receiving application you can fetch data back.

    Useful also in case of transferring data from .NET to legacy VB6 apps wherein you will marshal the data to memory, pass pointer to VB6 app using win msging, use VB6 copymemory() to fetch data from the managed memory space to VB6 apps unmanaged memory space..

提交回复
热议问题