{"id":317945,"date":"2021-02-12T21:00:43","date_gmt":"2021-02-12T21:00:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=317945"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=317945","title":{"rendered":"\u0414\u043e\u043b\u0436\u0435\u043d \u043b\u0438 out-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430?"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f6d\/236\/2a2\/f6d2362a272354d261d4cb9a440117da.png\" alt=\"0800_OutParamsCs_ru\/image1.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u0438\u0441\u0430\u043b \u043d\u0430 C#, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c out-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c\u0438 \u0432\u0441\u0451 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435? \u0414\u043b\u044f \u0437\u0430\u0442\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0434\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0438 \u043e\u0442\u0432\u0435\u0442\u044c\u0442\u0435, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void CheckYourself(out MyStruct obj) {   \/\/ Do nothing }<\/code><\/pre>\n<p>  <\/p>\n<p><em>MyStruct<\/em> \u2014 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0442\u0438\u043f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public struct MyStruct { .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438 &#8216;\u0434\u0430&#8217; \u0438\u043b\u0438 &#8216;\u043d\u0435\u0442&#8217; \u2014 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043a \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0451 \u043d\u0435 \u0442\u0430\u043a \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e&#8230;<\/p>\n<p>  <\/p>\n<h2 id=\"predystoriya\">\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u0438. \u041a\u0430\u043a \u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u043b\u0438\u0441\u044c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432?<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f <a href=\"https:\/\/www.viva64.com\/ru\/pvs-studio\/\">PVS-Studio<\/a>. \u0418\u0434\u0435\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <em>CancellationToken<\/em>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u0442\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0438\u043b\u0438 \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e) \u043d\u0430 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043e\u0442\u043c\u0435\u043d\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0442\u043c\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412 \u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0438 \u043d\u0430\u0448\u043b\u0438 \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void Foo(out CancellationToken ct, ....) {   ....   if (flag)     ct = someValue;   else     ct = otherValue;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e false positive \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0431\u043e\u0440 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d, &quot;\u0441 out \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438&quot;. \u041e\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0435\u0441\u0442\u043e\u0432, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0442\u0435\u0441\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void TestN(out CancellationToken ct) {   Console.WriteLine(&quot;....&quot;); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043c\u0435\u043d\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0438 \u0442\u0435\u0441\u0442\u044b \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u043e \u044f \u043f\u043e\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443\u2026 \u0418 \u0442\u0443\u0442 \u043c\u0435\u043d\u044f \u043e\u0441\u0435\u043d\u0438\u043b\u043e! \u0410 \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f? \u0418 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435? \u041a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f. \u0422\u0443\u0442 \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043d\u0430\u043c\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u044c\u044f. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0434\u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c <em>CancellationToken<\/em> \u043d\u0430 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0442\u0438\u043f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>TimeSpan<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void TestN(out TimeSpan timeSpan) {   Console.WriteLine(&quot;....&quot;); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0427\u0442\u043e \u0436, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e. \u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 <em>CancellationToken<\/em>?<\/p>\n<p>  <\/p>\n<h2 id=\"modifikator-parametra-out\">\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 out<\/h2>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043d\u043e\u0432\u044c \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0437\u0430 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u0430\u043a\u043e\u0439 \u2014 <em>out<\/em>. \u0412\u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u0437\u0438\u0441\u044b, \u0432\u0437\u044f\u0442\u044b\u0435 \u0441 docs.microsoft.com (<a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/keywords\/out-parameter-modifier\">out parameter modifier<\/a>):<\/p>\n<p>  <\/p>\n<ul>\n<li>The <em>out <\/em>keyword causes arguments to be passed by reference;<\/li>\n<li>Variables passed as <em>out <\/em>arguments do not have to be initialized before being passed in a method call. <strong><em>However, the called method is required to assign a value before the method returns.<\/em><\/strong><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u0441\u043e\u0431\u043e \u043f\u0440\u043e\u0448\u0443 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u2014 \u0432\u043e\u043f\u0440\u043e\u0441. \u0412 \u0447\u0451\u043c \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0440\u0451\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u043d\u0435\u0442?<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void Method1(out String obj) \/\/ compilation error { }  void Method2(out TimeSpan obj) \/\/ compilation error { }  void Method3(out CancellationToken obj) \/\/ no compilation error { }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0432\u0438\u0434\u043d\u043e. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0434\u043e\u043a\u0430\u0445? \u0414\u043b\u044f \u0442\u0438\u043f\u0430 <em>CancellationToken<\/em>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0425\u043e\u0442\u044f \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e \u2014 \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0433\u043e? \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044f \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0435 \u043d\u0430\u0448\u0451\u043b. \u0417\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430:<em> For more information, see the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/language-specification\/introduction\">C# Language Specification<\/a>. The language specification is the definitive source for C# syntax and usage.<\/em><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b &quot;<a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/language-specification\/classes#output-parameters\">Output parameters<\/a>&quot;. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u2014 \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: <em>Every output parameter of a method must be definitely assigned before the method returns.<\/em><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b0c\/a6f\/ca9\/b0ca6fca9529cb9e72cf9e7db82d0c8d.png\" alt=\"0800_OutParamsCs_ru\/image2.png\"><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u0440\u0430\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u044f\u0437\u044b\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u043d\u0430\u043c \u043d\u0435 \u0434\u0430\u043b\u0438, \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0435. \ud83d\ude42<\/p>\n<p>  <\/p>\n<h2 id=\"pogruzhaemsya-v-roslyn\">\u041f\u043e\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f \u0432 Roslyn<\/h2>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Roslyn \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u043e <a href=\"https:\/\/github.com\/dotnet\/roslyn\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<\/a>. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0432\u0437\u044f\u043b \u0432\u0435\u0442\u043a\u0443 <em>master<\/em>. \u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c <em>Compilers.sln<\/em>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <em>csc.csproj<\/em>. \u041c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u0435 \u0441 \u043d\u0430\u0448\u0438\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">struct MyStruct {   String _field; }  void CheckYourself(out MyStruct obj) {   \/\/ Do nothing }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435, \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0430 \u0444\u0430\u0439\u043b\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u043c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434. \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435: <em>error CS0177: The out parameter &#8216;obj&#8217; must be assigned to before control leaves the current method<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 \u0434\u043b\u044f \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u0434. \u0421\u0430\u043c \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 (CS0177) \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438, \u0430 \u0432\u043e\u0442 \u0441\u0442\u0440\u043e\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043b\u0435\u0436\u0438\u0442 \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445. \u0418 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a \u2014 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441 <em>ERR_ParamUnassigned<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">&lt;data name=&quot;ERR_ParamUnassigned&quot; xml:space=&quot;preserve&quot;&gt;   &lt;value&gt;The out parameter '{0}' must be assigned to           before control leaves the current method&lt;\/value&gt; &lt;\/data&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e \u0442\u043e\u043c\u0443 \u0436\u0435 \u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u2014 <em>ERR_ParamUnassigned = 177<\/em>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u0434\u0435. \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 (\u043c\u0435\u0442\u043e\u0434 <em>DefiniteAssignmentPass.ReportUnassignedOutParameter<\/em>):<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">protected virtual void ReportUnassignedOutParameter(   ParameterSymbol parameter,    SyntaxNode node,    Location location) {   ....   bool reported = false;   if (parameter.IsThis)   {     ....   }    if (!reported)   {     Debug.Assert(!parameter.IsThis);     Diagnostics.Add(ErrorCode.ERR_ParamUnassigned, \/\/ &lt;=                     location,                      parameter.Name);   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u0435 \u043d\u0430\u0441 \u043c\u0435\u0441\u0442\u043e! \u0421\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u0447\u043a\u0443 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0430 \u0438 \u0443\u0431\u0435\u0436\u0434\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u2014 \u043d\u0443\u0436\u043d\u043e\u0435 \u043d\u0430\u043c \u043c\u0435\u0441\u0442\u043e. \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u0432 <em>Diagnostics<\/em> \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/64a\/fa3\/282\/64afa32829476415323121a3950babcb.png\" alt=\"0800_OutParamsCs_ru\/image3.png\"><\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436, \u0448\u0438\u043a\u0430\u0440\u043d\u043e. \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c <em>MyStruct<\/em> \u043d\u0430 <em>CancellationToken<\/em>, \u0438\u0438\u0438\u2026 \u041c\u044b \u0432\u0441\u0451 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c \u044d\u0442\u0443 \u0432\u0435\u0442\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <em>Diagnostics<\/em>. \u0422\u043e \u0435\u0441\u0442\u044c, \u043e\u043d\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435! \u0412\u043e\u0442 \u044d\u0442\u043e \u043f\u043e\u0432\u043e\u0440\u043e\u0442.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e, \u0433\u0434\u0435 \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u2014 \u043d\u0443\u0436\u043d\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0432 \u043a\u043e\u0434\u0435, \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 <em>DefiniteAssignmentPass.Analyze<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b \u0437\u0430\u043f\u0443\u0441\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0435\u0433\u043e, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435, \u0447\u0442\u043e <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0412 \u043d\u0451\u043c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f 2 \u0440\u0430\u0437\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ Run the strongest version of analysis DiagnosticBag strictDiagnostics = analyze(strictAnalysis: true); .... \/\/ Also run the compat (weaker) version of analysis to see     if we get the same diagnostics. \/\/ If any are missing, the extra ones from the strong analysis     will be downgraded to a warning. DiagnosticBag compatDiagnostics = analyze(strictAnalysis: false);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0438\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ If the compat diagnostics did not overflow and we have the same     number of diagnostics, we just report the stricter set. \/\/ It is OK if the strict analysis had an overflow here,    causing the sets to be incomparable: the reported diagnostics will \/\/ include the error reporting that fact. if (strictDiagnostics.Count == compatDiagnostics.Count) {   diagnostics.AddRangeAndFree(strictDiagnostics);   compatDiagnostics.Free();   return; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u043f\u0440\u043e\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0438, strict, \u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u043a\u043e\u0434 \u0441 <em>MyStruct<\/em>, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438 \u0432\u044b\u0434\u0430\u0434\u0438\u043c.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a07\/b9e\/8b5\/a07b9e8b50658392973fa1b599ead0e9.png\" alt=\"0800_OutParamsCs_ru\/image4.png\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043c\u044b \u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <em>MyStruct<\/em> \u043d\u0430 <em>CancellationToken<\/em>, <em>strictDiagnostics<\/em> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c 1 \u043e\u0448\u0438\u0431\u043a\u0443 (\u043a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438), \u0430 \u0432 <em>compatDiagnostics<\/em> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9d8\/e55\/e4d\/9d8e55e4dd576579596a6633aaffb587.png\" alt=\"0800_OutParamsCs_ru\/image5.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u041a\u0443\u0434\u0430 \u0436\u0435 \u0434\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438? \u0410 \u043e\u043d\u0430 \u043f\u043e\u043d\u0438\u0436\u0430\u0435\u0442\u0441\u044f \u0434\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">HashSet&lt;Diagnostic&gt; compatDiagnosticSet    = new HashSet&lt;Diagnostic&gt;(compatDiagnostics.AsEnumerable(),                              SameDiagnosticComparer.Instance); compatDiagnostics.Free(); foreach (var diagnostic in strictDiagnostics.AsEnumerable()) {   \/\/ If it is a warning (e.g. WRN_AsyncLacksAwaits),       or an error that would be reported by the compatible analysis,       just report it.   if (   diagnostic.Severity != DiagnosticSeverity.Error        || compatDiagnosticSet.Contains(diagnostic))   {     diagnostics.Add(diagnostic);     continue;   }    \/\/ Otherwise downgrade the error to a warning.   ErrorCode oldCode = (ErrorCode)diagnostic.Code;   ErrorCode newCode = oldCode switch   { #pragma warning disable format     ErrorCode.ERR_UnassignedThisAutoProperty        =&gt; ErrorCode.WRN_UnassignedThisAutoProperty,     ErrorCode.ERR_UnassignedThis                    =&gt; ErrorCode.WRN_UnassignedThis,     ErrorCode.ERR_ParamUnassigned                   \/\/ &lt;=             =&gt; ErrorCode.WRN_ParamUnassigned,     ErrorCode.ERR_UseDefViolationProperty           =&gt; ErrorCode.WRN_UseDefViolationProperty,     ErrorCode.ERR_UseDefViolationField              =&gt; ErrorCode.WRN_UseDefViolationField,     ErrorCode.ERR_UseDefViolationThis               =&gt; ErrorCode.WRN_UseDefViolationThis,     ErrorCode.ERR_UseDefViolationOut                =&gt; ErrorCode.WRN_UseDefViolationOut,     ErrorCode.ERR_UseDefViolation                   =&gt; ErrorCode.WRN_UseDefViolation,     _ =&gt; oldCode, \/\/ rare but possible, e.g.                       ErrorCode.ERR_InsufficientStack occurring in                       strict mode only due to needing extra frames #pragma warning restore format   };    ....   var args       = diagnostic is DiagnosticWithInfo {           Info: { Arguments: var arguments }         }         ? arguments         : diagnostic.Arguments.ToArray();   diagnostics.Add(newCode, diagnostic.Location, args); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <em>CancellationToken<\/em>? \u0412 \u0446\u0438\u043a\u043b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u0445\u043e\u0434 <em>strictDiagnostics<\/em> (\u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u043e \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440). <em>Then<\/em>-\u0432\u0435\u0442\u0432\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>if<\/em> \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a <em>diagnostic.Severity <\/em> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>DiagnosticSeverity.Error<\/em>, \u0430 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f <em>compatDiagnosticSet<\/em> \u043f\u0443\u0441\u0442\u0430. \u0410 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u043a\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u0434 \u2014 \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e. \u0422\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c \u0432 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0432\u0438\u0434\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u0432\u044b\u0434\u0430\u0447\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430, \u0443\u043a\u0430\u0437\u0430\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u043b\u0430\u0433: <em>csc.exe %pathToFile% -w:5<\/em><\/p>\n<p>  <\/p>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4da\/6b2\/583\/4da6b25834c76dde226bd44a7e341b7f.png\" alt=\"0800_OutParamsCs_ru\/image6.png\"><\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u2014 \u043e\u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0438\u0437\u043a\u043e\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0443 \u043d\u0430\u0441 \u0434\u043e \u0441\u0438\u0445 \u043f\u043e\u0440 \u043d\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441, \u0432 \u0447\u0451\u043c \u0436\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c <em>CancellationToken<\/em> \u0438 \u0435\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 <em>MyStruct<\/em>? \u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0441 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <em>MyStruct<\/em> compat \u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0430 \u043a\u043e\u0433\u0434\u0430 \u0442\u0438\u043f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2014 <em>CancellationToken<\/em> \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f?<\/p>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0437\u0430\u0432\u0430\u0440\u0438\u0442\u044c \u0447\u0430\u0448\u0435\u0447\u043a\u0443 \u0447\u0430\u044f \u0438\u043b\u0438 \u043a\u043e\u0444\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u043d\u0430\u0441 \u0436\u0434\u0451\u0442 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/690\/733\/ea3\/690733ea38e1e22ce80e12eec5242766.png\" alt=\"0800_OutParamsCs_ru\/image7.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0441\u043e\u0432\u0435\u0442\u043e\u043c \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438\u0441\u044c. \u041c\u044b \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434 <em>ReportUnassignedParameter<\/em>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438? \u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">protected override void LeaveParameter(ParameterSymbol parameter,                                         SyntaxNode syntax,                                         Location location) {   if (parameter.RefKind != RefKind.None)   {     var slot = VariableSlot(parameter);     if (slot &gt; 0 &amp;&amp; !this.State.IsAssigned(slot))     {       ReportUnassignedOutParameter(parameter, syntax, location);     }      NoteRead(parameter);   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u0437 strict \u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>slot<\/em> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1, \u0430 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2014 -1. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f <em>then<\/em>-\u0432\u0435\u0442\u0432\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>if<\/em>. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <em>slot<\/em> \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1.<\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <em>LocalDataFlowPass.VariableSlot<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">protected int VariableSlot(Symbol symbol, int containingSlot = 0) {   containingSlot = DescendThroughTupleRestFields(                      ref symbol,                       containingSlot,                                                         forceContainingSlotsToExist: false);    int slot;   return      (_variableSlot.TryGetValue(new VariableIdentifier(symbol,                                                        containingSlot),                                 out slot))      ? slot      : -1; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <em>_variableSlot<\/em> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043b\u043e\u0442\u0430 \u043f\u043e\u0434 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, <em>_variableSlot.TryGetValue(&#8230;.)<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>false<\/em>, \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438\u0434\u0451\u0442 \u043f\u043e alternative-\u0432\u0435\u0442\u0432\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 ?:, \u0438 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 <em>_variableSlot<\/em> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/739\/682\/bdf\/739682bdf61fb8b525c41f84a14bc57f.png\" alt=\"0800_OutParamsCs_ru\/image8.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <em>LocalDataFlowPass.GetOrCreateSlot<\/em>. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">protected virtual int GetOrCreateSlot(   Symbol symbol,    int containingSlot = 0,    bool forceSlotEvenIfEmpty = false,    bool createIfMissing = true) {   Debug.Assert(containingSlot &gt;= 0);   Debug.Assert(symbol != null);    if (symbol.Kind == SymbolKind.RangeVariable) return -1;    containingSlot      = DescendThroughTupleRestFields(         ref symbol,          containingSlot,         forceContainingSlotsToExist: true);    if (containingSlot &lt; 0)   {     \/\/ Error case. Diagnostics should already have been produced.     return -1;   }    VariableIdentifier identifier      = new VariableIdentifier(symbol, containingSlot);   int slot;    \/\/ Since analysis may proceed in multiple passes,       it is possible the slot is already assigned.   if (!_variableSlot.TryGetValue(identifier, out slot))   {     if (!createIfMissing)     {       return -1;     }      var variableType = symbol.GetTypeOrReturnType().Type;     if (!forceSlotEvenIfEmpty &amp;&amp; IsEmptyStructType(variableType))     {       return -1;     }      if (   _maxSlotDepth &gt; 0          &amp;&amp; GetSlotDepth(containingSlot) &gt;= _maxSlotDepth)     {       return -1;     }      slot = nextVariableSlot++;     _variableSlot.Add(identifier, slot);     if (slot &gt;= variableBySlot.Length)     {       Array.Resize(ref this.variableBySlot, slot * 2);     }      variableBySlot[slot] = identifier;   }    if (IsConditionalState)   {     Normalize(ref this.StateWhenTrue);     Normalize(ref this.StateWhenFalse);   }   else   {     Normalize(ref this.State);   }    return slot; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0440\u044f\u0434 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u043e\u0434 \u0432\u0435\u0440\u043d\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1, \u0430 \u0441\u043b\u043e\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 <em>_variableSlot<\/em>. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043b\u043e\u0442\u0430 \u043f\u043e\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0435\u0449\u0451 \u043d\u0435\u0442, \u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 <em>_variableSlot<\/em>: <em>_variableSlot.Add(identifier, slot)<\/em>. \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u0438 \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 strict \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442, \u0430 \u0432\u043e\u0442 \u043f\u0440\u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043c\u044b \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 <em>if<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var variableType = symbol.GetTypeOrReturnType().Type; if (!forceSlotEvenIfEmpty &amp;&amp; IsEmptyStructType(variableType)) {   return -1; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>forceSlotEvenIfEmpty<\/em> \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 (<em>false<\/em>), \u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <em>IsEmptyStructType<\/em>: \u0434\u043b\u044f strict \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u2014 <em>false<\/em>, \u0434\u043b\u044f compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u2014 <em>true<\/em>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/083\/bac\/8e9\/083bac8e95237b17e364961edfc97e9f.png\" alt=\"0800_OutParamsCs_ru\/image9.png\"><\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0442\u0438\u043f <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2014 &quot;\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&quot; (\u043f\u043e\u0437\u0436\u0435 \u043c\u044b \u043f\u043e\u0439\u043c\u0451\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442), \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u0438 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443? \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0437 <em>MyStruct<\/em> \u043f\u043e\u043b\u0435 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">struct MyStruct {  }  void CheckYourself(out MyStruct obj) {   \/\/ Do nothing }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f! \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u2026 \u0423\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439 \u0442\u0430\u043a\u0438\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u044f \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u043f\u043e\u043c\u043d\u044e. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0430 \u043a\u0430\u043a \u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0434 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0442\u0438\u043f <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u2014 <em>CancellationToken<\/em>? \u0412\u0435\u0434\u044c \u044d\u0442\u043e \u044f\u0432\u043d\u043e \u043d\u0435 &quot;\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&quot; \u2014 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 referencesource.microsoft.com (<a href=\"https:\/\/referencesource.microsoft.com\/#mscorlib\/system\/threading\/CancellationToken.cs,36b17ded8b1a228c\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 CancellationToken<\/a>), \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0438 \u043f\u043e\u043b\u044f\u2026 \u041d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u043e\u043f\u0430\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u0435 <em>LocalDataFlowPass.IsEmptyStructType<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">protected virtual bool IsEmptyStructType(TypeSymbol type) {   return _emptyStructTypeCache.IsEmptyStructType(type); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0434\u0451\u043c \u0433\u043b\u0443\u0431\u0436\u0435 (<em>EmptyStructTypeCache.IsEmptyStructType<\/em>):<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public virtual bool IsEmptyStructType(TypeSymbol type) {   return IsEmptyStructType(type, ConsList&lt;NamedTypeSymbol&gt;.Empty); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0435\u0449\u0451 \u0433\u043b\u0443\u0431\u0436\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private bool IsEmptyStructType(   TypeSymbol type,    ConsList&lt;NamedTypeSymbol&gt; typesWithMembersOfThisType) {   var nts = type as NamedTypeSymbol;   if ((object)nts == null || !IsTrackableStructType(nts))   {     return false;   }    \/\/ Consult the cache.   bool result;   if (Cache.TryGetValue(nts, out result))   {     return result;   }    result = CheckStruct(typesWithMembersOfThisType, nts);   Debug.Assert(!Cache.ContainsKey(nts) || Cache[nts] == result);   Cache[nts] = result;    return result; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438\u0434\u0451\u0442 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <em>EmptyStructTypeCache.CheckStruct<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private bool CheckStruct(   ConsList&lt;NamedTypeSymbol&gt; typesWithMembersOfThisType,    NamedTypeSymbol nts) {   ....    if (!typesWithMembersOfThisType.ContainsReference(nts))   {     ....     typesWithMembersOfThisType        = new ConsList&lt;NamedTypeSymbol&gt;(nts,                                        typesWithMembersOfThisType);     return CheckStructInstanceFields(typesWithMembersOfThisType, nts);   }    return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u0432 <em>then<\/em>-\u0432\u0435\u0442\u0432\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>if<\/em>, \u0442.\u043a. \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f <em>typesWithMembersOfThisType<\/em> \u043f\u0443\u0441\u0442\u0430\u044f (\u0441\u043c. \u043c\u0435\u0442\u043e\u0434 <em>EmptyStructTypeCache.IsEmptyStructType<\/em>, \u0433\u0434\u0435 \u043e\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430). <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u0443\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0432\u044b\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u2014 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 &quot;\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&quot;. \u0421\u0443\u0434\u044f \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u044d\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439. \u041d\u043e \u044f \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0432 <em>CancellationToken<\/em> \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0435\u0441\u0442\u044c. \u0417\u043d\u0430\u0447\u0438\u0442, \u0438\u0434\u0451\u043c \u0435\u0449\u0451 \u0433\u043b\u0443\u0431\u0436\u0435, \u0432 \u043c\u0435\u0442\u043e\u0434 <em>EmptyStructTypeCache.CheckStructInstanceFields<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private bool CheckStructInstanceFields(   ConsList&lt;NamedTypeSymbol&gt; typesWithMembersOfThisType,    NamedTypeSymbol type) {   ....   foreach (var member in type.OriginalDefinition                              .GetMembersUnordered())   {     if (member.IsStatic)     {       continue;     }     var field = GetActualField(member, type);     if ((object)field != null)     {       var actualFieldType = field.Type;       if (!IsEmptyStructType(actualFieldType,                               typesWithMembersOfThisType))       {         return false;       }     }   }    return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u044b\u0435 \u0447\u043b\u0435\u043d\u044b, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f &#8216;actualField&#8217;. \u0414\u0430\u043b\u044c\u0448\u0435, \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (<em>field<\/em> \u2014 \u043d\u0435 <em>null<\/em>) \u043e\u043f\u044f\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0442\u0438\u043f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f &quot;\u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439&quot;? \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0430\u0448\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u043d\u0443 &quot;\u043d\u0435 \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443&quot;, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0442\u0430\u043a\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u043c &quot;\u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439&quot;. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u2014 &quot;\u043f\u0443\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b&quot;, \u0442\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u0442\u0430\u043a\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f &quot;\u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439&quot;.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c\u0441\u044f \u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0433\u043b\u0443\u0431\u0436\u0435. \u041d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u0442\u0435\u0441\u044c, \u0441\u043a\u043e\u0440\u043e \u043d\u0430\u0448\u0435 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f, \u0438 \u043c\u044b \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u043e\u0447\u043a\u0438 \u043d\u0430\u0434 &#8216;i&#8217;. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u043c\u0435\u0442\u043e\u0434 <em>EmptyStructTypeCache.GetActualField<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private FieldSymbol GetActualField(Symbol member, NamedTypeSymbol type) {   switch (member.Kind)   {     case SymbolKind.Field:       var field = (FieldSymbol)member;       ....       if (field.IsVirtualTupleField)       {         return null;       }        return (field.IsFixedSizeBuffer ||                ShouldIgnoreStructField(field, field.Type))              ? null              : field.AsMember(type);        case SymbolKind.Event:         var eventSymbol = (EventSymbol)member;         return (!eventSymbol.HasAssociatedField ||                 ShouldIgnoreStructField(eventSymbol, eventSymbol.Type))               ? null               : eventSymbol.AssociatedField.AsMember(type);   }    return null; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u043b\u044f \u0442\u0438\u043f\u0430 <em>CancellationToken<\/em> \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 <em>case<\/em>-\u0432\u0435\u0442\u0432\u044c <em>SymbolKind.Field<\/em>. \u0412 \u043d\u0435\u0451 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u0447\u043b\u0435\u043d\u0430 <em>m_source<\/em> \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0442.\u043a. \u0442\u0438\u043f <em>CancellationToken<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 <em>m_source<\/em>).<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u044d\u0442\u043e\u0439 <em>case<\/em>-\u0432\u0435\u0442\u0432\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  <\/p>\n<p><em>field.IsVirtualTupleField<\/em> \u2014 <em>false<\/em>. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 \u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>field.IsFixedSizeBuffer || ShouldIgnoreStructField(field, field.Type)<\/em>. <em>field.IsFixedSizeBuffer<\/em> \u2014 \u043d\u0435 \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e, <em>false<\/em>. \u0410 \u0432\u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <em>ShouldIgnoreStructField(field, field.Type),<\/em> \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f strict \u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430 (\u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u043c\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u043f\u043e\u043b\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430).<\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043b\u043e \u043c\u0435\u0442\u043e\u0434\u0430 <em>EmptyStructTypeCache.ShouldIgnoreStructField<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private bool ShouldIgnoreStructField(Symbol member,                                       TypeSymbol memberType) {   \/\/ when we're trying to be compatible with the native compiler, we       ignore imported fields (an added module is imported)      of reference type (but not type parameters,       looking through arrays)      that are inaccessible to our assembly.    return _dev12CompilerCompatibility &amp;&amp;                                       ((object)member.ContainingAssembly != _sourceAssembly ||              member.ContainingModule.Ordinal != 0) &amp;&amp;                                IsIgnorableType(memberType) &amp;&amp;                                           !IsAccessibleInAssembly(member, _sourceAssembly);           }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f strict \u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u0425\u043e\u0442\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>Strict \u0430\u043d\u0430\u043b\u0438\u0437: <em>_dev12CompilerCompatibility<\/em> \u2014 <em>false<\/em>, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u2014 <em>false<\/em>. Compat \u0430\u043d\u0430\u043b\u0438\u0437: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u2014 <em>true<\/em>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u0441\u0435\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u2014 <em>true<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044f\u0441\u044c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u043e\u043d\u0446\u0430. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0435 \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0442\u0438\u043f\u0430 <em>CancellationSource<\/em> \u2014 <em>m_source<\/em>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e <em>CancellationToken<\/em> \u2014 &quot;\u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430&quot;, \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043d\u0435\u0451 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u043b\u043e\u0442, \u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043a\u044d\u0448 &quot;\u043f\u0443\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440&quot;. \u0422\u0430\u043a \u043a\u0430\u043a \u0441\u043b\u043e\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043c\u044b \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438 \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, strict \u0438 compat \u0430\u043d\u0430\u043b\u0438\u0437 \u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0434\u043e \u043d\u0438\u0437\u043a\u043e\u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u044d\u0442\u043e \u043d\u0435 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043e\u0441\u043e\u0431\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u0438\u043f\u0430 <em>CancellationToken<\/em> \u2014 \u0435\u0441\u0442\u044c \u0446\u0435\u043b\u044b\u0439 \u0440\u044f\u0434 \u0442\u0438\u043f\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043e\u0448\u0438\u0431\u043a\u0430\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c. \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0431\u0435\u0440\u0451\u043c \u043d\u0430\u0448 \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void CheckYourself(out MyType obj) {   \/\/ Do nothing }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e <em>MyType<\/em> \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0438\u043f\u044b. \u041c\u044b \u0443\u0436\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f <em>CancellationToken<\/em> \u0438 \u0434\u043b\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0427\u0442\u043e \u0435\u0449\u0451?<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">struct MyStruct { }  struct MyStruct2 {   private MyStruct _field; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u043e <em>MyType<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <em>MyStruct2<\/em>, \u043a\u043e\u0434 \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public struct MyExternalStruct {   private String _field; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 <em>MyExternalStruct<\/em> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0431\u043e\u0440\u043a\u0435. \u0415\u0441\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <em>CheckYourself<\/em> \u2014 \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f (\u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e\u043b\u044f <em>_field<\/em> \u0441 <em>private<\/em> \u043d\u0430 <em>public<\/em>):<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public struct MyExternalStruct {   public String _field; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 \u043a\u043e\u0434 \u0442\u043e\u0436\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f (\u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 \u0442\u0438\u043f \u043f\u043e\u043b\u044f \u0441\u043e <em>String<\/em> \u043d\u0430 <em>int<\/em>):<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public struct MyExternalStruct {   private int _field; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438, \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0440 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2 id=\"podytozhim\">\u041f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c<\/h2>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0438 \u0446\u0435\u043b\u043e\u043c, <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432\u0435\u0440\u043d\u0451\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430, \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0432\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432 \u044d\u0442\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435, \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0418\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043c\u044b \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0442\u0438\u043f\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u0435\u0441\u043b\u0438 \u0442\u0438\u043f \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0435\u0442 \u043f\u043e\u043b\u0435\u0439. \u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0435\u0437 \u043f\u043e\u043b\u0435\u0439. \u0418\u043b\u0438 \u0432\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 <em>CancellationToken<\/em>: \u0441 \u043d\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435, \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 <em>m_source<\/em> \u0441\u0441\u044b\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0430 \u0441\u0430\u043c\u043e \u043f\u043e\u043b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043e\u0434\u0430. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c <em>out<\/em>-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u0448 \u043a\u043e\u0434.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u0438\u0437 \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">void CheckYourself(out MyStruct obj) {   \/\/ Do nothing } public struct MyStruct { .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434? \u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b\u0438, \u043d\u0438 &#8216;\u0414\u0430&#8217;, \u043d\u0438 &#8216;\u041d\u0435\u0442&#8217; \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u043e\u043c. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <em>MyStruct<\/em> (\u043a\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044f, \u0433\u0434\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0442\u0438\u043f \u0438 \u0442. \u043f.), \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043b\u0438\u0431\u043e \u043d\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u0432\u043e\u0442 \u0443 \u043d\u0430\u0441 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441. \u042f \u0434\u0443\u043c\u0430\u044e, \u0441\u043a\u043e\u0440\u043e \u043c\u044b \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043c \u044d\u0442\u043e\u0442 \u043e\u043f\u044b\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c. \u0422\u0430\u043a \u0447\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u0438. \ud83d\ude09<\/p>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/twitter.com\/_SergVasiliev_\">\u043c\u043e\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0432 Twitter<\/a>, \u0433\u0434\u0435 \u044f \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u043a\u0438. \u0422\u0430\u043a \u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u0435. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Sergey Vasiliev. <a href=\"https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/542208\/\">Should We Initialize an Out Parameter Before a Method Returns?<\/a>.<\/p>\n<\/div>\n<p> \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:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/542210\/\"> https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/542210\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f6d\/236\/2a2\/f6d2362a272354d261d4cb9a440117da.png\" alt=\"0800_OutParamsCs_ru\/image1.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043a\u0430\u0436\u0434\u044b\u0439, \u043a\u0442\u043e \u043f\u0438\u0441\u0430\u043b \u043d\u0430 C#, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c out-\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441 \u043d\u0438\u043c\u0438 \u0432\u0441\u0451 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041d\u043e \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435? \u0414\u043b\u044f \u0437\u0430\u0442\u0440\u0430\u0432\u043a\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u043f\u0440\u043e\u0432\u0435\u0440\u043a\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-317945","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317945","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=317945"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/317945\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=317945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=317945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=317945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}