c++结构怎么用C#实现
这是C++的定义和调用方式,用C#怎么实现typedefstructtmConnectInfo_t{unsignedintdwSize;charpIp[32];intiP...
这是C++的定义和调用方式,用C#怎么实现
typedef struct tmConnectInfo_t
{
unsigned int dwSize;
char pIp[32];
int iPort;
char szUser[32];
char szPass[32];
int iUserLevel;
unsigned char pUserContext[USER_CONTEXT_SIZE];
}tmConnectInfo_t;
tmConnectInfo_t cninfo;
cninfo.dwSize = sizeof(tmConnectInfo_t);
sprintf(cninfo.pIp, "192.168.1.88");
cninfo.iPort = 6002;
sprintf(cninfo.szUser, "system");
sprintf(cninfo.szPass, "system"); 展开
typedef struct tmConnectInfo_t
{
unsigned int dwSize;
char pIp[32];
int iPort;
char szUser[32];
char szPass[32];
int iUserLevel;
unsigned char pUserContext[USER_CONTEXT_SIZE];
}tmConnectInfo_t;
tmConnectInfo_t cninfo;
cninfo.dwSize = sizeof(tmConnectInfo_t);
sprintf(cninfo.pIp, "192.168.1.88");
cninfo.iPort = 6002;
sprintf(cninfo.szUser, "system");
sprintf(cninfo.szPass, "system"); 展开
1个回答
展开全部
C# 的实现和使用方式如下:
public struct ConnectInfo
{
public uint Size { get; set; }
public string Ip { get; set; }
public int Port { get; set; }
public string User { get; set; }
public string Pass { get; set; }
public int UserLevel { get; set; }
public object UserContext { get; set; }
}
ConnectInfo info=new ConnectInfo()
{
Ip="192.168.1.88",
Port=6002,
User="system",
Pass="system"
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询