加密.NET中的SOAP消息
By Dan Wahlin
.NET提供了一种编写自定义加密应用程序的方法,可以用来加密一个SOAP消息的敏感部分。(([更多信息]

用SQLXML3.0呈现SQL Server存储过程
By Jay Schmelzer
SQLXML3.0可以很简单地将SQL Server 2000存储过程呈现为XML Web Services。([更多信息]

C#中如何通过指针操作struct数组?
Question:

using System;
using System.Runtime.InteropServices;

class test
{
[StructLayout(LayoutKind.Explicit)]
public struct tmp
{
[FieldOffset(0)]
public int i;
[FieldOffset(4)]
public int f;
}

[MarshalAs(UnmanagedType.LPStruct)]
static tmp[] b;

public unsafe static void Main()
{
tmp[] a;
a = new tmp[2];
a[0].i = 10;
a[0].f = 10;
a[1].i = 20;
a[1].f = 20;

b = a;

fixed (tmp* p = b)
{
tmp* ps = p;
for (int i = 0; i < 2; i++)
{
Console.WriteLine("{0}", *((int*)ps));
Console.WriteLine("{0}", *((int*)(ps+4)));
}
}
}
}

Answer:

可以试试这样:

[StructLayout(LayoutKind.Sequential)]
public struct ABC
{
public int A;
public int B;
}

private unsafe void button1_Click(object sender, System.EventArgs e)
{
ABC[] abc = new ABC[2];
abc[0].A = 1;
abc[0].B = 2;
abc[1].A = 3;
abc[1].B = 4;

fixed( ABC *p = abc )
{
ABC* ps = p;
for( int i = 0; i < 2; i++ )
{
MessageBox.Show( ps->A.ToString() + " " + ps->B.ToString() );
ps++;
}
}
}