' 构造体的声明
Structure SECURITY_ATTRIBUTES
Dim nLength As Integer
Dim lpSecurityDescriptor As Integer
Dim bInheritHandle As Integer
End Structure' 构造体的对象
Dim udtProcessAttributes As SECURITY_ATTRIBUTES' 取构造体的字节数
Len(udtProcessAttributes)
请问,上述VB代码如何能转换成C#?
Structure SECURITY_ATTRIBUTES
Dim nLength As Integer
Dim lpSecurityDescriptor As Integer
Dim bInheritHandle As Integer
End Structure' 构造体的对象
Dim udtProcessAttributes As SECURITY_ATTRIBUTES' 取构造体的字节数
Len(udtProcessAttributes)
请问,上述VB代码如何能转换成C#?
{
public int nLength;
public int lpSecurityDescriptor;
public int bInheritHandle;
}
public class FileUpload
{
public void Test()
{
//构造体的对象
SECURITY_ATTRIBUTES udtProcessAttributes; //取构造体的字节数
udtProcessAttributes.nLength = System.Runtime.InteropServices.Marshal.SizeOf(udtProcessAttributes);
}
}
struct SECURITY_ATTRIBUTES
{
int nLength;
int lpSecurityDescriptor;
int bInheritHandle;
}
// 构造体的对象
SECURITY_ATTRIBUTES udtProcessAttributes;
后面那个不知道什么意思
//结构的声明
struct SECURITY_ATTRIBUTES
{
int nLength;
int lpSecurityDescriptor;
int bInheritHandle;
}//结构的对象
SECURITY_ATTRIBUTES udtProcessAttributes = new SECURITY_ATTRIBUTES();//取结构的字节数
System.Runtime.InteropServices.Marshal.SizeOf(udtProcessAttributes)
不知道对不对哦
struct SECURITY_ATTRIBUTES
{
public int nLength;
public int lpSecurityDescriptor;
public int bInheritHandle;
} //' 构造体的对象
SECURITY_ATTRIBUTES udtProcessAttributes; private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(Marshal.SizeOf(udtProcessAttributes).ToString() );
}