public static class NetLoader { /// <summary> /// Load an assembly, using the internal method /// </summary> /// <param name="buffer">Your .NET PE</param> /// <returns>A loaded assembly</returns> public static Assembly Load(byte[] buffer) { var param = GetParameters(); param[0] = buffer; return (Assembly)method.Invoke(null, param); } private static object[] GetParameters() { if (MajorVersion() >= 4) return new object[] { null, null, null, null, false, null }; else return new object[] { null, null, null, null, false }; } private static new Type GetType() { if (MajorVersion() >= 4) return Type.GetType("System.Reflection.RuntimeAssembly"); else return Type.GetType("System.Reflection.Assembly"); } private static MethodInfo GetMethod(Type type) { return type.GetMethod("nLoadImage", BindingFlags.Static | BindingFlags.NonPublic); } private static int MajorVersion() { return Environment.Version.Major; } static Type type; static MethodInfo method; static NetLoader() { type = GetType(); method = GetMethod(type); } } Код public static class NetLoader { /// <summary> /// Load an assembly, using the internal method /// </summary> /// <param name="buffer">Your .NET PE</param> /// <returns>A loaded assembly</returns> public static Assembly Load(byte[] buffer) { var param = GetParameters(); param[0] = buffer; return (Assembly)method.Invoke(null, param); } private static object[] GetParameters() { if (MajorVersion() >= 4) return new object[] { null, null, null, null, false, null }; else return new object[] { null, null, null, null, false }; } private static new Type GetType() { if (MajorVersion() >= 4) return Type.GetType("System.Reflection.RuntimeAssembly"); else return Type.GetType("System.Reflection.Assembly"); } private static MethodInfo GetMethod(Type type) { return type.GetMethod("nLoadImage", BindingFlags.Static | BindingFlags.NonPublic); } private static int MajorVersion() { return Environment.Version.Major; } static Type type; static MethodInfo method; static NetLoader() { type = GetType(); method = GetMethod(type); } }