简体   繁体   中英

How to use vb6 copymemory in c#?

This is vb6 codes:

Dim i    As Long
CopyMemory fkey(0), pass(0), 4& * i

I know CopyMemory(destination, source, length) . But I dont know how to implement it in c#.

I have one empty long array, and one byte array with values.

Source : byte array.

Destination : long array.

How do i use CopyMemory in c# for these two arrays?

Since you're copying from and to arrays you can just you Buffer.BlockCopy .

Buffer.BlockCopy(pass, 0, fkey, 0, 4)

This will treat the arrays as byte arrays, so the index is in bytes, not in the size of the data-type.

You can learn more online: MSDN Online Docs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM