static BigEndianStructHelper()
        {
            string          code = GenerateCode();
            CodeDomProvider cdp  = CodeDomProvider.CreateProvider("C#");

            // 编译器的参数
            CompilerParameters cp = new CompilerParameters();

            cp.ReferencedAssemblies.Add(typeof(T).Assembly.Location);
            cp.ReferencedAssemblies.Add("System.Core.dll");
            foreach (var ass in typeof(T).Assembly.GetReferencedAssemblies())
            {
                if (ass.Name != "System.Core")
                {
                    var refAss = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == ass.Name);
                    if (refAss != null)
                    {
                        cp.ReferencedAssemblies.Add(refAss.Location);
                    }
                    else
                    {
                    }
                }
            }

            cp.GenerateExecutable = false;
            cp.GenerateInMemory   = true;
            CompilerResults cr = cdp.CompileAssemblyFromSource(cp, code);


            if (cr.Errors.HasErrors)
            {
                Exception ex = new Exception();
                ex.Data["code"] = code;
                throw ex;
            }
            else
            {
                // 编译后的程序集
                Assembly   ass           = cr.CompiledAssembly;
                Type       type          = ass.GetType(string.Format("{0}.{1}", typeof(BigEndianStructHelper <T>).Namespace, GenerateStructHelperClassName(typeof(T))));
                MethodInfo structToBytes = type.GetMethod("StructToBytes");
                MethodInfo bytesToStruct = type.GetMethod("BytesToStruct");
                structToBytesExecutor = new DynamicMethodExecutor(structToBytes);
                bytesToStructExecutor = new DynamicMethodExecutor(bytesToStruct);
            }
        }