{"id":284633,"date":"2017-04-07T19:20:18","date_gmt":"2017-04-07T15:20:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=284633"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=284633","title":{"rendered":".NET Managed + C unmanaged: \u043a\u0430\u043a\u043e\u0432\u0430 \u0446\u0435\u043d\u0430?"},"content":{"rendered":"<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044f \u043d\u0430 C#, \u044f \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043d\u043e\u0441\u0438\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0421\u0438 \u043a\u043e\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c .NET \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u0418 \u0432\u043e\u0442 \u0437\u0430 \u0447\u0430\u0448\u0435\u0447\u043a\u043e\u0439 \u0447\u0430\u044f \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043d\u0430\u0447\u0430\u043b\u0438 \u043b\u0435\u0437\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b: \u0410 \u043a\u0430\u043a\u043e\u0439 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043e\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430? \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c, \u0430 \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e, \u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e? \u041a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c API \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435?<\/p>\n<p>  \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0432\u0441\u0435 \u0436\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0441\u0435\u0431\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  <b>\u0417\u0430\u0447\u0435\u043c?<\/b> <\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0434\u0430\u0441\u0442 \u043b\u044e\u0431\u043e\u0439 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442. \u0412\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u0434\u0432\u0443\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u2013 \u0434\u0435\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u0435\u043d \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043e\u0442\u043b\u0430\u0434\u043a\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435. \u041d\u043e \u043b\u0438\u0448\u044c \u0441\u0430\u043c\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0443\u0436\u0435 \u0434\u043e\u0441\u0442\u043e\u0439\u043d\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u0430\u0445 \u0438\u043b\u0438 \u0432 \u0432\u044b\u0441\u043e\u043a\u043e \u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. <\/p>\n<p>  \u0414\u0440\u0443\u0433\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442: \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 unamaged \u0432\u0438\u0434\u0435! \u0417\u0430\u0447\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u043c\u0438 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u0432 .NET \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430?<\/p>\n<p>  \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445 \u2013 \u0442\u0430\u043a\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f. \u0410 \u043c\u044b \u043b\u0438\u0448\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0430 \u043a\u0430\u043a.<\/p>\n<p>  <b>\u041b\u0438\u0440\u0438\u043a\u0430<\/b><\/p>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u0432 Visual Studio Community 2015. \u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0447\u0435-\u0438\u0433\u0440\u043e\u0432\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0441 i5-3470 \u043d\u0430 \u0431\u043e\u0440\u0442\u0443, 12-\u044e \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u043c\u0438 1333MHz \u0434\u0432\u0443\u0445\u043a\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0436\u0435\u0441\u0442\u043a\u0438\u043c \u0434\u0438\u0441\u043a\u043e\u043c \u043d\u0430 7200 rpm. \u0417\u0430\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e System.Diagnostics.Stopwatch, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u043e\u0447\u043d\u0435\u0435 DateTime, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u043e\u0432\u0435\u0440\u0445 PerformanceCounter. \u0422\u0435\u0441\u0442\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438\u0441\u044c \u043d\u0430 Release \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445 \u0441\u0431\u043e\u0440\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0430\u0447\u0435. \u0412\u0435\u0440\u0441\u0438\u044f \u0444\u0440\u044d\u0439\u043c\u0432\u043e\u0440\u043a\u0430 .NET 4.5.2, \u0430 C++ \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441 \u0444\u043b\u0430\u0433\u043e\u043c \/TC (Compile as C).<\/p>\n<p>  \u0417\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0431\u0438\u043b\u0438\u0435 \u043a\u043e\u0434\u0430, \u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044f \u0434\u043e\u0431\u0438\u0432\u0430\u043b\u0441\u044f. \u0411\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0443\u0434\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u044f \u0432\u044b\u043d\u0435\u0441 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u044b, \u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0438 \u0432\u043e\u0432\u0441\u0435 \u0432\u044b\u0440\u0435\u0437\u0430\u043b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 (\u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u0435\u0449\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0435).<\/p>\n<p>  <b>\u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/b><\/p>\n<p>  \u0421\u0432\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u0437\u0430\u043c\u0435\u0440\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041f\u0440\u0438\u0447\u0438\u043d \u043d\u0430 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c, \u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 dll \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e, \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u043a\u043e\u0434\u043e\u043c \u0432 \u0442\u043e\u043c \u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u0435. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 C#-\u043e\u0431\u0435\u0440\u0442\u043e\u043a \u043f\u043e\u0432\u0435\u0440\u0445 \u043b\u044e\u0431\u043e\u0433\u043e \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 (\u043d\u0430\u043f\u0440. <b><i>sharpgl<\/i><\/b>, <b><i>openal-cs<\/i><\/b>, <i><s>\u0430 sharpdx \u0443\u0448\u0435\u043b \u043a\u0443\u0434\u0430-\u0442\u043e \u043d\u0435 \u0432 \u0442\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0443<\/s><\/i>). \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430\u0448\u0438\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u00abCSV!\u00bb, \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f, \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u044d\u0442\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f CSV<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">    public class CSVReport : IDisposable     {         int columnsCount;         StreamWriter writer;         public CSVReport(string path, params string[] header)         {             columnsCount = header.Length;             writer = new StreamWriter(path);             writer.Write(header[0]);             for (int i = 1; i &lt; header.Length; i++)                 writer.Write(&quot;,&quot; + header[i]);             writer.Write(&quot;\\r\\n&quot;);         }          public void Write(params object[] values)         {             if (values.Length != columnsCount)                 throw new ArgumentException(&quot;Columns count for row didn't match table columns count&quot;);             writer.Write(values[0].ToString());             for (int i = 1; i &lt; values.Length; i++)                 writer.Write(&quot;,&quot; + values[i].ToString());             writer.Write(&quot;\\r\\n&quot;);         }          public void Dispose()         {             writer.Close();         }     }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u043d\u043e \u0434\u043b\u044f \u043c\u043e\u0435\u0439 \u0446\u0435\u043b\u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0441 \u043b\u0438\u0445\u0432\u043e\u0439. \u0410 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u043b\u0438\u0448\u044c \u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0412\u043e\u0442 \u0442\u0430\u043a \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442:<\/p>\n<pre><code class=\"cs\">    class Summer     {         public int Sum         {             get; private set;         }          public Summer()         {             Sum = 0;         }          public void Add(int a)         {             Sum += a;         }          public void Reset()         {             Sum = 0;         }     }<\/code><\/pre>\n<p>  \u041d\u043e \u044d\u0442\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442. \u041d\u0430\u043c \u0436\u0435 \u043d\u0443\u0436\u0435\u043d \u0435\u0449\u0435 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 dll \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0443\u0434\u0430 \u0444\u0430\u0439\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, api.h, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0438\u0445\u0438\u0432\u0430\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430:<\/p>\n<pre><code class=\"cpp\">#ifndef _API_H_ #define _API_H_ \u00a0 #define EXPORT  __declspec(dllexport) #define STD_API __stdcall \u00a0 #endif<\/code><\/pre>\n<p>  \u0420\u044f\u0434\u044b\u0448\u043a\u043e\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u043c summer.c, \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b:<\/p>\n<pre><code class=\"cpp\">#include &quot;api.h&quot;  int sum;  EXPORT void STD_API summer_init( void ) { \tsum = 0; }  EXPORT void STD_API summer_add( int value ) { \tsum += value; }  EXPORT int STD_API summer_sum( void ) { \treturn sum; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043b\u0430\u0441\u0441-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u044d\u0442\u0438\u043c \u0431\u0435\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0435\u043c:<\/p>\n<pre><code class=\"cpp\">    class SummerUnmanaged     {         const string dllName = @&quot;unmanaged_test.dll&quot;;         [DllImport(dllName)]         private static extern void summer_init();          [DllImport(dllName)]         private static extern void summer_add(int v);          [DllImport(dllName)]         private static extern int summer_sum();          public int Sum         {             get             {                 return summer_sum();             }         }          public SummerUnmanaged()         {             summer_init();         }          public void Add(int a)         {             summer_add(a);         }          public void Reset()         {             summer_init();         }     }<\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0435\u0433\u043e \u044f \u0438 \u0445\u043e\u0442\u0435\u043b. \u0415\u0441\u0442\u044c \u0434\u0432\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438: \u043e\u0434\u043d\u0430 \u043d\u0430 C#, \u0432\u0442\u043e\u0440\u0430\u044f \u043d\u0430 \u0421\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0439\u0434\u0435\u0442! \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043c\u0435\u0440\u0438\u0442 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f n \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<pre><code class=\"cs\">        static void TestCall()         {             Console.WriteLine(&quot;Function calls...&quot;);             Stopwatch sw = new Stopwatch();             Summer s_managed = new Summer();             SummerUnmanaged s_unmanaged = new SummerUnmanaged();             Random r = new Random();             int[] data;             CSVReport report = new CSVReport(&quot;fun_call.csv&quot;, &quot;elements&quot;, &quot;C# managed&quot;, &quot;C unmanaged&quot;);             data = new int[1000000];             for (int j = 0; j &lt; 1000000; j++)                 data[j] = r.Next(-1, 2); \/\/ \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0443\u0441\u043e\u0440              for (int i=0; i&lt;100; i++)             {                 \/\/ \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0436\u0434\u0430\u0442\u044c \u0443 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u043e\u0433\u043e\u0434\u044b                 Console.Write(&quot;\\r{0}\/100&quot;, i+1);                 int length = 10000*i;                 long managedTime = 0, unmanagedTime = 0;                 Thread.Sleep(10);                 s_managed.Reset();                 sw.Start();                 for (int j = 0; j &lt; length; j++)                 {                     s_managed.Add(data[j]);                 }                 sw.Stop();                 managedTime = sw.ElapsedTicks;                 sw.Reset();                 sw.Start();                 for(int j=0; j&lt;length; j++)                 {                     s_unmanaged.Add(data[j]);                 }                 sw.Stop();                 unmanagedTime = sw.ElapsedTicks;                 report.Write(length, managedTime, unmanagedTime);             }             report.Dispose();             Console.WriteLine();         }<\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0432 \u043c\u044d\u0439\u043d\u0435, \u0434\u0430 \u043f\u043e\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 fun_call.csv. \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043a\u0443\u0447\u043d\u044b\u0435 \u0438 \u0441\u0443\u0445\u0438\u0435 \u0446\u0438\u0444\u0440\u044b, \u0430 \u0432\u044b\u0432\u0435\u0434\u0443 \u043b\u0438\u0448\u044c \u0433\u0440\u0430\u0444\u0438\u043a. \u041f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u2013 \u0432\u0440\u0435\u043c\u044f \u0432 \u0442\u0438\u043a\u0430\u0445, \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cb2\/035\/93c\/cb203593c2fe4e95915ff6de45e25909.png\"\/><\/p>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u0435\u043d\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u0438\u0432\u0438\u043b. C# \u044f\u0432\u043d\u043e \u0431\u044b\u043b \u0444\u0430\u0432\u043e\u0440\u0438\u0442\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0442\u0435\u0441\u0442\u0435. \u0412\u0441\u0435-\u0442\u0430\u043a\u0438, \u0442\u043e\u0442 \u0436\u0435 \u043c\u043e\u0434\u0443\u043b\u044c, \u0434\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u043d\u043b\u0430\u0439\u043d\u0438\u0442\u044c\u2026 \u043d\u043e \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c\u0438. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u2013 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u0430\u043b\u0438, \u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u043b\u0438.<\/p>\n<p>  <b>\u041c\u0430\u0441\u0441\u0438\u0432\u044b<\/b><\/p>\n<p>  \u0420\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u0445 \u0431\u044b\u043b\u0438 \u043d\u0435 \u0434\u043e\u043b\u0433\u0438\u043c\u0438, \u0438 \u044f \u0442\u0443\u0442 \u0436\u0435 \u043f\u043e\u043d\u044f\u043b \u2013 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443, \u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434. \u0414\u043e\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b:<\/p>\n<pre><code class=\"cs\">        public void AddMany(int[] data)         {             int length = data.Length;             for (int i = 0; i &lt; length; i++)                 Sum += i;         }<\/code><\/pre>\n<p>  \u0418, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0421\u0438 \u0447\u0430\u0441\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">EXPORT int STD_API summer_add_many( int* data, int length ) {         for ( int i = 0; i &lt; length; i++ )                 sum += data[ i ]; }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cs\">        [DllImport(dllName)]         private static extern void summer_add_many(int[] data, int length); \u00a0         public void AddMany(int[] data)         {             summer_add_many(data, data.Length);         }<\/code><\/pre>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u043b\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0435, \u0430 \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445: \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 n \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0445 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">        static void TestArrays()         {             Console.WriteLine(&quot;Arrays...&quot;);             Stopwatch sw = new Stopwatch();             Summer s_managed = new Summer();             SummerUnmanaged s_unmanaged = new SummerUnmanaged();             Random r = new Random();             int[] data;             CSVReport report = new CSVReport(&quot;arrays.csv&quot;, &quot;elements&quot;, &quot;C# managed&quot;, &quot;C unmanaged&quot;);              for (int i = 0; i &lt; 100; i++)             {                 Console.Write(&quot;\\r{0}\/100&quot;, i+1);                 int length = 10000 * i;                 long managedTime = 0, unmanagedTime = 0;                 data = new int[length];                 for (int j = 0; j &lt; length; j++) \/\/ \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0443\u0441\u043e\u0440                     data[j] = r.Next(-1, 2);                 s_managed.Reset();                 sw.Start();                 s_managed.AddMany(data);                 sw.Stop();                 managedTime = sw.ElapsedTicks;                 sw.Reset();                 sw.Start();                 s_unmanaged.AddMany(data);                 sw.Stop();                 unmanagedTime = sw.ElapsedTicks;                 report.Write(length, managedTime, unmanagedTime);             }             report.Dispose();             Console.WriteLine();         }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043e\u0442\u0447\u0435\u0442. \u041f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u0440\u0435\u043c\u044f \u0432 \u0442\u0438\u043a\u0430\u0445, \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b69\/a1d\/9cc\/b69a1d9ccccc46ccbf1a07eb4c057682.png\"\/><\/p>\n<p>  \u0412\u0438\u0434\u043d\u043e \u043d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0433\u043b\u0430\u0437\u043e\u043c \u2014 \u0421\u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432. \u041d\u043e \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0446\u0435\u043d\u0430 \u0437\u0430 \u00ab\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0441\u0442\u044c\u00bb \u2013 \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u043a\u0430\u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0432\u044b\u0445\u043e\u0434\u0430 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430, <s>\u043d\u0435\u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0444\u0430\u0437\u044b \u041b\u0443\u043d\u044b \u0441 \u0444\u0430\u0437\u043e\u0439 \u041c\u0430\u0440\u0441\u0430<\/s> \u043c\u044f\u0433\u043a\u043e \u043a\u0438\u043d\u0435\u0442 \u044d\u043a\u0441\u0435\u043f\u0448\u043d, \u0442\u043e \u0441\u0438-\u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u0441\u0432\u043e\u044e \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0438\u0434, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043d\u0430\u0434\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0440\u0438\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u041a\u0441\u0442\u0430\u0442\u0438, \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0442\u0438 \u043a \u0440\u0430\u0437\u0443\u043c\u043d\u043e\u043c\u0443 \u0432\u044b\u0432\u043e\u0434\u0443 \u043e \u0442\u043e\u043c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u043d\u0435\u0440\u043e\u0432\u043d\u044b\u043c\u0438. \u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0444\u0430\u0437\u044b GC \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u043e\u0442\u044a\u0435\u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u0447\u043d\u043e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0443\u0441\u0440\u0435\u0434\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0421\u0438 \u0432 \u0440\u0430\u0437\u044b \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.  <\/div>\n<\/div>\n<p>  <b>\u0427\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/b><\/p>\n<p>  \u0423\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0440\u0443\u043f\u043d\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0421\u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u2014 \u043d\u0430\u0434\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b. \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0443\u0441\u0442\u0440\u043e \u043a\u043e\u0434 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u0442\u043e\u043f\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432 (\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0449\u0438\u0445 \u0432 \u0441\u0432\u043e\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435)<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">        static void Generate()         {             Random r = new Random();             for(int i=0; i&lt;100; i++)             {                 BinaryWriter writer = new BinaryWriter(File.OpenWrite(&quot;file&quot; + i.ToString()));                 for(int j=0; j&lt;200000*i; j++)                 {                     writer.Write(r.Next(-1, 2));                 }                 writer.Close();                 Console.WriteLine(&quot;Generating {0}&quot;, i);             }         }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0441\u0430\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0430\u0439\u043b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f 75 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442, \u0447\u0435\u0433\u043e \u0431\u044b\u043b\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u044f \u043d\u0435 \u0441\u0442\u0430\u043b \u0432\u044b\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0430 \u043d\u0430<s>\u0431\u044b\u0434\u043b\u043e<\/s>\u043a\u043e\u0434\u0438\u043b \u043f\u0440\u044f\u043c\u043e \u0432 \u043a\u043b\u0430\u0441\u0441 \u043c\u044d\u0438\u043d\u0430. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<pre><code class=\"cs\">        static int FileSum(string path)         {             BinaryReader br = new BinaryReader(File.OpenRead(path));             int sum = 0;             long length = br.BaseStream.Length;             while(br.BaseStream.Position != length)             {                 sum += br.ReadInt32();             }             br.Close();              return sum;         }<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0434\u0430, \u0437\u0430\u0434\u0430\u0447\u0443 \u044f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e: \u043f\u0440\u043e\u0441\u0443\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0446\u0435\u043b\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u0421\u0438:<\/p>\n<pre><code class=\"cpp\">EXPORT int STD_API file_sum( const char* path ) { \tFILE *f = fopen( path, &quot;rb&quot; ); \tif ( !f ) \t\treturn 0; \tint sum = 0; \twhile ( !feof( f ) ) \t{ \t\tint add; \t\tfread( &add, sizeof( int ), 1, f ); \t\tsum += add; \t} \tfclose( f ); \treturn sum; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b, \u0434\u0430 \u0438\u0437\u043c\u0435\u0440\u0438\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u0436\u0434\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443 (\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438 \u0441\u0430\u043c\u043e\u043c\u0443) \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0443 \u0441\u0440\u0430\u0437\u0443 \u043a \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f\u043c. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/391\/af9\/5c8\/391af95c820d4621aaabb4f7f03199a5.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430, \u0421\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 (\u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0440\u0430\u0437\u0430). \u041d\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u0435\u0441\u0442\u044c \u0432\u044b\u0438\u0433\u0440\u044b\u0448.<\/p>\n<p>  \u0413\u0434\u0435-\u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043c\u0435\u043d\u044f \u043f\u043e\u043d\u0435\u0441\u043b\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432 \u0441\u0442\u0435\u043f\u044c (\u0438\u043b\u0438 \u043a\u0443\u0434\u0430-\u0442\u043e \u0435\u0449\u0435), \u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u0438\u043c\u0438 \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u044f \u043d\u0435 \u043c\u043e\u0433\u0443. \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0443 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440, \u0430 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0443 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u043e\u0438\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u0442\u0435\u043f\u044c<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u0435\u043d\u044f \u0443\u0436\u0430\u0441\u0430\u043b\u043e. \u041e\u043f\u044b\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u0441\u0440\u0430\u0437\u0443 \u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043c\u043e\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u2013 \u043e\u043d <i>\u0441\u043b\u0438\u0448\u043a\u043e\u043c<\/i> \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430. \u042d\u0442\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044f \u0441\u043b\u0435\u0433\u043a\u0430 \u043c\u043e\u0434\u0435\u0440\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0447\u0442\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043e 400\u041a\u0431 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430, \u0447\u0442\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0432\u0441\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u043e. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u0421\u0438 \u0438 \u0421# \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"cs\">            long length = br.BaseStream.Length;             byte[] buffer = new byte[100000*4];             while(br.BaseStream.Position != length)             {                 int read = br.Read(buffer, 0, 100000*4);                 for(int i=0; i&lt;read; i+=4)                 {                     sum += BitConverter.ToInt32(buffer, i);                 }             }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">\tint sum = 0; \tint *buffer = malloc( 100000 * sizeof( int ) ); \twhile ( !feof( f ) ) \t{ \t\tint read = fread( buffer, sizeof( int ), 100000, f ); \t\tfor ( int i = 0; i &lt; read; i++ ) \t\t{ \t\t\tsum += buffer[ i ]; \t\t} \t}<\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u044f \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0432 \u00ab\u043e\u0441\u043d\u043e\u0432\u0443\u00bb \u0441\u0442\u0430\u0442\u044c\u0438, \u0438 \u043d\u0430 \u0442\u043e \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0430: \u0442\u0435\u0441\u0442 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b\u0439. \u0421\u0438 \u044f\u0432\u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u0438 \u043a\u0443\u0434\u0430 \u0443\u0433\u043e\u0434\u043d\u043e, \u0430 \u0432\u043e\u0442 \u0432 C# \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u043e\u0431\u0430\u0439\u0442\u043e\u0432\u043e, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/aac\/b8b\/5b3\/aacb8b5b3e7f46dfb79f66385477a2bf.png\"\/><\/p>\n<p>  \u042f \u0441\u043a\u043b\u043e\u043d\u0435\u043d \u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0432 \u0441\u043b\u043e\u0432\u0430. \u0412\u043e\u043e\u0431\u0449\u0435, \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0430\u0436\u0435 \u043d\u0430\u043f\u0438\u0448\u0443.  <\/div>\n<\/div>\n<p>  <b>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432<\/b><\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0432 \u0437\u0430\u043c\u0435\u0440\u0430\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u0446\u0435\u043b\u044b\u043c\u0438 \u0438 \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443: \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442\u043e\u0432.<\/p>\n<p>  \u041d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c C# \u0442\u0430\u043a\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u0421\u0438 \u043a\u043e\u0434 \u0441 C# \u043a\u043e\u0434\u043e\u043c \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0435-\u0447\u0442\u043e \u0435\u0449\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 C#<\/p>\n<pre><code class=\"cs\">        static byte[] FileRead(string path)         {             BinaryReader br = new BinaryReader(File.OpenRead(path));             byte[] ret = br.ReadBytes((int)br.BaseStream.Length);             br.Close();             return ret;         }<\/code><\/pre>\n<p>  \u0418 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0421\u0438:<\/p>\n<pre><code class=\"cpp\">EXPORT char* STD_API file_read( const char* path, int* read ) { \tFILE *f = fopen( path, &quot;rb&quot; ); \tif ( !f ) \t\treturn 0;  \tfseek( f, 0, SEEK_END ); \tlong length = ftell( f ); \tfseek( f, 0, SEEK_SET ); \tread = length;  \tint sum = 0; \tuint8_t *buffer = malloc( length ); \tint read_f = fread( buffer, 1, length, f ); \tfclose( f );  \treturn buffer; }<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 C# \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e, \u0434\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a:<\/p>\n<pre><code class=\"cs\">        static byte[] FileReadUnmanaged(string path)         {             int length = 0;             IntPtr unmanaged = file_read(path, ref length);             byte[] managed = new byte[length];             Marshal.Copy(unmanaged, managed, 0, length);             Marshal.FreeHGlobal(unmanaged); \/\/ \u041c\u044b \u0436\u0435 \u043d\u0435 \u0436\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0442\u0435\u043a\u0430\u0442\u044c?             return managed;         }<\/code><\/pre>\n<p>  \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u0430\u043c\u0435\u0440\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u043c\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0410 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/716\/54d\/7e8\/71654d7e86e44f0ebd35bfe66802fc22.png\"\/><\/p>\n<p>  \u0414\u0430\u0436\u0435 \u0441 \u043f\u043e\u0442\u0435\u0440\u044f\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u0421\u0438 \u0441\u043d\u043e\u0432\u0430 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0432 \u043b\u0438\u0434\u0435\u0440\u0430\u0445, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 2 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u044f \u043e\u0436\u0438\u0434\u0430\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 (\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430). \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u0436\u0435 \u043a\u0440\u0443\u043f\u043d\u043e\u0439 \u043f\u0430\u0447\u043a\u043e\u0439 \u0432 C# \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e. \u0412 \u0421\u0438 \u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u0434\u0435\u0442 \u043f\u0440\u0438 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0440\u0438\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435 \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e Marshal.Free\u2026 \u043f\u0430\u0434\u0430\u0435\u0442 \u0432 Debug \u0441\u0431\u043e\u0440\u043a\u0435. \u0427\u0435\u043c \u044d\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043d\u043e \u044f \u043d\u0435 \u043f\u043e\u043d\u044f\u043b, \u043d\u043e \u0432 Release \u0441\u0431\u043e\u0440\u043a\u0435 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e \u0438 \u043d\u0435 \u0442\u0435\u043a\u043b\u043e. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0441\u0430\u043c\u044b\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 free \u0438\u0437 \u0421\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0430\u043b\u043e \u043d\u0430 \u0447\u0442\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442.  <\/div>\n<\/div>\n<p>  <b>\u0420\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430<\/b><\/p>\n<p>  \u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u043e\u044e \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u044b\u043b\u043e \u0442\u0430\u043a\u0438\u043c: \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 C# \u0438 \u043d\u0430 \u0421\u0438. \u0411\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043e\u0446\u0435\u043d\u0438\u0442\u044c.<\/p>\n<p>  \u0417\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u044f \u043f\u0440\u0438\u043d\u044f\u043b \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u0436\u0430\u0442\u043e\u0433\u043e TGA \u0444\u0430\u0439\u043b\u0430 \u0441 32 \u0431\u0438\u0442\u0430\u043c\u0438 \u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u044c, \u0434\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0435\u0433\u043e \u0432 <s>\u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435<\/s> RGBA \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (TGA \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u043a\u0430\u043a BGRA). \u0427\u0442\u043e\u0431\u044b \u0436\u0438\u0437\u043d\u044c \u043d\u0435 \u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043c\u0430\u0441\u043b\u043e\u043c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0435 \u0431\u0430\u0439\u0442\u044b, \u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Color:<\/p>\n<pre><code class=\"cs\">        struct Color         {             public byte r, g, b, a;         }<\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0435\u043c\u043a\u0430\u044f, \u0434\u0430 \u0438 \u0432\u0440\u044f\u0434 \u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0430 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043c\u043e\u0437\u043e\u043b\u0438\u0442\u044c \u0433\u043b\u0430\u0437\u0430 \u0442\u0435\u043c, \u043a\u043e\u043c\u0443 \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f TGA<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">        static Color[] TGARead(string path)         {             byte[] header;             BinaryReader br = new BinaryReader(File.OpenRead(path));             header = br.ReadBytes(18);             int width = (header[13] &lt;&lt; 8) + header[12];  \/\/ \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u043c\u0430\u0433\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c short             int height = (header[15] &lt;&lt; 8) + header[14]; \/\/ Little-Endian, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b             byte[] data;             data = br.ReadBytes(width * height * 4);             Color[] colors = new Color[width * height];             for(int i=0; i&lt;width*height*4; i+=4)             {                 int index = i \/ 4;                 colors[index].b = data[i];                 colors[index].g = data[i + 1];                 colors[index].r = data[i + 2];                 colors[index].a = data[i + 3];             }             br.Close();             return colors;         }         static Color[] TGAReadUnmanaged(string path)         {             int width = 0, height = 0;             IntPtr colors = tga_read(path, ref width, ref height);             IntPtr save = colors;             Color[] ret = new Color[width * height];             for(int i=0; i&lt;width*height; i++)             {                 ret[i] = Marshal.PtrToStructure&lt;Color&gt;(colors);                 colors += 4;             }             Marshal.FreeHGlobal(save);             return ret;         } <\/code><\/pre>\n<p>  \u0418 \u0421\u0438\u0448\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<pre><code class=\"cpp\">#include &quot;api.h&quot;  #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  \/\/ \u0412\u0435\u0434\u0435\u0442 \u043a \u0431\u0435\u0434\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0432\u044b\u0440\u043e\u0432\u043d\u044f\u0435\u0442\u0441\u044f \/\/ \u043d\u0435 \u043f\u043e 4 \u0431\u0430\u0439\u0442\u0430\u043c typedef struct { \tchar r, g, b, a; } COLOR;   \/\/ \u041a\u043e\u0441\u0442\u044b\u043b\u044c, \u0447\u0442\u043e\u0431\u044b \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0446\u0435\u043b\u0438\u043a\u043e\u043c #pragma pack(push) #pragma pack(1) typedef struct { \tchar idlength; \tchar colourmaptype; \tchar datatypecode; \tshort colourmaporigin; \tshort colourmaplength; \tchar colourmapdepth; \tshort x_origin; \tshort y_origin; \tshort width; \tshort height; \tchar bitsperpixel; \tchar imagedescriptor; } TGAHeader; #pragma pack(pop)  EXPORT COLOR* tga_read( const char* path, int* width, int* height ) { \tTGAHeader header; \tFILE *f = fopen( path, &quot;rb&quot; ); \tfread( &header, sizeof( TGAHeader ), 1, f ); \tCOLOR *colors = malloc( sizeof( COLOR ) * header.height * header.width ); \tfread( colors, sizeof( COLOR ), header.height * header.width, f ); \tfor ( int i = 0; i &lt; header.width * header.height; i++ ) \t{ \t\tchar t = colors[ i ].r; \t\tcolors[ i ].r = colors[ i ].b; \t\tcolors[ i ].b = t; \t} \tfclose( f );  \treturn colors; }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043c\u0430\u043b\u044b\u043c. \u041d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 TGA \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0435\u0433\u043e n \u0440\u0430\u0437. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u0438\u043c (\u043f\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u043f\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438 \u2013 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0442\u0435\u043d\u0438\u0439 \u0444\u0430\u0439\u043b\u0430).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/86c\/60d\/edb\/86c60dedb9ed4193835767465180ea6d.png\"\/><\/p>\n<p>  \u0422\u0443\u0442 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u044f \u043d\u0430\u0433\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0421\u0438 \u0432 \u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u0443. \u0427\u0438\u0442\u0430\u0442\u044c \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u044f\u043c\u043e \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u043b\u043e \u0436\u0438\u0437\u043d\u044c (\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432\u044b\u0440\u043e\u0432\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0435 \u043f\u043e 4 \u0431\u0430\u0439\u0442\u0430\u043c, \u0431\u0443\u0434\u0435\u0442 \u0432\u0435\u0441\u0435\u043b\u0430\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0430). \u041e\u0434\u043d\u0430\u043a\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u044f \u0434\u043e\u0432\u043e\u043b\u0435\u043d. \u0422\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u043d\u0435\u0437\u0430\u043c\u044b\u0441\u043b\u043e\u0432\u0430\u0442\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0421\u0438, \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u0435\u0433\u043e \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 C#. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e, \u043d\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430. \u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432\u043e\u0432\u0441\u0435, \u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437.<\/p>\n<p>  <b>\u0421\u0443\u0445\u043e\u0439 \u043e\u0441\u0442\u0430\u0442\u043e\u043a<\/b><\/p>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u0441\u0430\u043c\u0430 \u0438\u0434\u0435\u044f \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0433\u043e-\u0442\u043e \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u044f\u0437\u044b\u043a \u0441\u043e\u043c\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430, \u043a\u0430\u043a \u044f \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u043c\u0443 \u0441\u043f\u043e\u0441\u043e\u0431\u0443 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u0430\u043b\u043e. \u0415\u0441\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u0435\u0448\u0430\u0442\u044c UI \u2013 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u0438 \u0442\u043e\u0433\u0434\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u0436\u0435 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u043d\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043d\u0438 \u0443 \u043a\u043e\u0433\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0442\u0430\u043a \u0438\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430, \u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0435\u0435 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0443\u0442\u044f\u043c\u0438 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f (\u0430 \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0438\u0448\u0443\u0442 \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0421\u0438 \u0438\u043b\u0438 \u0421++). \u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0430 \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0430\u0442\u044c \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434.<\/p>\n<p>  \u0425\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0439 dll \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u0430 \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0434\u0430\u0441\u0442, \u0438 \u0432\u0441\u044f \u00ab\u0448\u0443\u0441\u0442\u0440\u043e\u0441\u0442\u044c\u00bb \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0430 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u0445\u0443\u0436\u0435 \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442.<\/p>\n<p>  C# \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c\u0443 \u043a\u043e\u0434\u0443, \u043d\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0442\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e, \u043a\u0430\u043a \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0430\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0438 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c \u043a\u043e\u0434\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \/ \u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u043c \u043a\u043e\u0434\u0435, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c IntPtr \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u043e\u0441\u0442\u0430\u0432\u0448\u0443\u044e\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u043d\u043e (\u0438 \u0434\u0430\u0436\u0435 \u043d\u0443\u0436\u043d\u043e) \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0435\u043c \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0435 \u043a\u043e\u0434\u0430 \u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438. \u041d\u043e \u0438 \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u0442\u0430\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<p>  \u0410 \u043d\u0430 \u044d\u0442\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430!<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/325954\/\"> https:\/\/habrahabr.ru\/post\/325954\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u0443\u044f \u043d\u0430 C#, \u044f \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043d\u043e\u0441\u0438\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0435\u043c\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043d\u0435\u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0421\u0438 \u043a\u043e\u0434, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c .NET \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u0418 \u0432\u043e\u0442 \u0437\u0430 \u0447\u0430\u0448\u0435\u0447\u043a\u043e\u0439 \u0447\u0430\u044f \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043d\u0430\u0447\u0430\u043b\u0438 \u043b\u0435\u0437\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b: \u0410 \u043a\u0430\u043a\u043e\u0439 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u043e\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430? \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c, \u0430 \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e, \u0442\u043e \u0441\u043a\u043e\u043b\u044c\u043a\u043e? \u041a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c API \u043f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435?<\/p>\n<p>  \u0421\u043f\u0443\u0441\u0442\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u0432\u0441\u0435 \u0436\u0435 \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0441\u0435\u0431\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e, \u0430 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441 \u0432\u0430\u043c\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-284633","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=284633"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/284633\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=284633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=284633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=284633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}