很强大的代码。可是不知道怎么时候。谁帮我弄弄
public static object EndianFlip(object oObject){
string sFieldType;
Type tyObject = oObject.GetType();
FieldInfo[] miMembers;
miMembers = tyObject.GetFields();
for (int Looper = miMembers.GetLowerBound(0);
Looper <= miMembers.GetUpperBound(0);
Looper++)
{
sFieldType = miMembers[Looper].FieldType.FullName;
if (((sFieldType, "System.UInt16", true) == 0))
{
ushort tmpUShort;
tmpUShort = (ushort)miMembers[Looper].GetValue(oObject);
tmpUShort = (ushort)(((tmpUShort & 0x00ff) << 8) +
((tmpUShort & 0xff00) >> 8));
miMembers[Looper].SetValue(oObject, tmpUShort);
}
else if ((sFieldType, "System.UInt32", true) == 0)
{
uint tmpInt;
tmpInt = (uint)miMembers[Looper].GetValue(oObject);
tmpInt = (uint)(((tmpInt & 0x000000ff) << 24) +
((tmpInt & 0x0000ff00) << 8) +
((tmpInt & 0x00ff0000) >> 8) +
((tmpInt & 0xff000000) >> 24));
miMembers[Looper].SetValue(oObject, tmpInt);
}
}
return (oObject);
}