C#问题CopyMemory

来源:百度知道 编辑:UC知道 时间:2024/06/21 10:52:12
VB 写是调用的系统API CopyMemory
假如我调用这个方法输入100 那么结果是1120403456 我想在C#中实现
但这个API我都不会声明它 或C#有没直接的方法

Function Float2Int(Ans As Single) As Long '浮点转整形
CopyMemory Float2Int, Ans, 4
End Function
SS 什么玩意 晕 还不要管 不能识别的能用啊 。。。

using System.Runtime.InteropServices;

[DllImport("kernel32.dll")]
public static extern void CopyMemory(byte[] Destination, SS[] add, int Length);

[DllImport("kernel32.dll")]
public static extern void CopyMemory(SS[] Destination, Byte[] Source, int Length);

using System.Runtime.InteropServices;

[DllImport("kernel32.dll")]
public static extern void CopyMemory(byte[] Destination, SS[] add, int Length);

[DllImport("kernel32.dll")]
public static extern void CopyMemory(SS[] Destination, Byte[] Source, int Length);

楼上的写的这个有点靠谱。
要用的时候直接调用CopyMemory( ...) 传参数就可以了.

不要管,生命方法而已