CS0254 fixed 语句赋值的右边不能是强制转换表达式
对不起了,没积分发不了技术贴,不过呢请教一下技术问题,以下是我的代码,总是编译不过,请问如何修改?:
using System;
using System.Runtime.InteropServices;
namespace PLCReadSave.csAsyncSocket
{
internal struct KeepAlive
{
public int Onoff;
public int KeepAliveTime;
public int KeepAliveInterval;
unsafe public byte[] buffer
{
get
{
byte[] array = new byte[sizeof(KeepAlive)];
fixed(IntPtr* value = (IntPtr*)&this)
{
Marshal.Copy(new IntPtr(value), array, 0, array.Length);
}
return array;
}
}
}
}