Access memory address in c#

前端 未结 4 1293
孤城傲影
孤城傲影 2021-02-04 19:34

I am interfacing with an ActiveX component that gives me a memory address and the number of bytes.

How can I write a C# program that will access the bytes starting at

4条回答
  •  萌比男神i
    2021-02-04 20:15

    C# can use pointers. Just use the 'unsafe' keyword in front of your class, block, method, or member variable (not local variables). If a class is marked unsafe all member variables are unsafe as well.

    unsafe class Foo
    {
    
    }
    
    unsafe int FooMethod
    {
    
    }
    

    Then you can use pointers with * and & just like C.

    I don't know about ActiveX Components in the same address space.

提交回复
热议问题