{"id":314878,"date":"2020-12-15T09:00:29","date_gmt":"2020-12-15T09:00:29","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=314878"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=314878","title":{"rendered":"\u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f C# \u043d\u0430 Reactive Extensions \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0418\u0432\u0430\u043d \u0438 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. <\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0448\u043b\u0430 \u043f\u0440\u0438\u0443\u0440\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043a \u0432\u044b\u0445\u043e\u0434\u0443 .NET 5 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f .NETConf 2020. \u041d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u0438\u043d \u0438\u0437 \u0434\u043e\u043a\u043b\u0430\u0434\u0447\u0438\u043a\u043e\u0432 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e <a href=\"https:\/\/www.youtube.com\/watch?v=3YwwdoRg2F4\" rel=\"noopener noreferrer nofollow\">C# Source Generators<\/a>. \u041f\u043e\u0438\u0441\u043a\u0430\u0432 \u043d\u0430 youtube \u043d\u0430\u0448\u0435\u043b \u0435\u0449\u0435 <a href=\"https:\/\/www.youtube.com\/watch?v=zHYd9o7-wlw\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435<\/a>. \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c. \u0412 \u043d\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u0434, \u0430 InteliSense \u0442\u0443\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0438\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0437\u044b\u043a\u0430 \u0438 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u044d\u0442\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u0418\u0434\u0435\u044f<\/h3>\n<p>\u0412\u0441\u0435 \u0436\u0435 \u0437\u043d\u0430\u044e\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/concepts\/linq\/\" rel=\"noopener noreferrer nofollow\">LINQ<\/a>? \u0422\u0430\u043a \u0432\u043e\u0442 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0435\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0432\u0438\u0434\u0435, \u0447\u0442\u043e \u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/concepts\/linq\/\" rel=\"noopener noreferrer nofollow\">LINQ <\/a>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a> \u043d\u0430\u0434\u043e \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 Reactive Extensions, \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0442\u043e \u0438 Reactive Extensions \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. \u0415\u0441\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f C# \u0432 \u0432\u0438\u0434 Reactive Extensions. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d \u0442\u0430\u043a. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c:<\/p>\n<pre><code class=\"cs\">public partial class Example {     public event Action&lt;int, string, bool&gt; ActionEvent; }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u044d\u0442\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"cs\">public static IObservable&lt;(int, string, bool)&gt; RxActionEvent(this TestConsoleApp.Example obj) {     if (obj == null) throw new ArgumentNullException(nameof(obj));     return Observable.FromEvent&lt;System.Action&lt;int, string, bool&gt;, (int, string, bool)&gt;(     conversion =&gt; (obj0, obj1, obj2) =&gt; conversion((obj0, obj1, obj2)),     h =&gt; obj.ActionEvent += h,     h =&gt; obj.ActionEvent -= h); }<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u043f\u043b\u044e\u0441\u0430\u043c\u0438 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var example = new  Example(); example.RxActionEvent().Where(obj =&gt; obj.Item1 &gt; 10).Take(1).Subscribe((obj)=&gt; { \/* some action  *\/});<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442, \u0438\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0441\u0442\u044b\u043b\u044c \u044d\u0442\u043e\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u0430\u043c, \u0430 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 InteliSense \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>1)&nbsp;\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0447\u043b\u0435\u043d\u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u043d\u0430 \u00abRx\u00bb, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>example.RxActionEvent()<\/code>, \u0430 \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Action ActionEvent, \u0430 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <code>.RxActionEvent()<\/code>, \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public static IObservable&lt;(System.Int32 Item1Int32, System.String Item2String, System.Boolean Item3Boolean)&gt; RxActionEvent(this TestConsoleApp.Example obj) {     if (obj == null) throw new ArgumentNullException(nameof(obj));     return Observable.FromEvent&lt;System.Action&lt;System.Int32, System.String, System.Boolean&gt;, (System.Int32 Item1Int32, System.String Item2String, System.Boolean  Item3Boolean)&gt;(     conversion =&gt; (obj0, obj1, obj2) =&gt; conversion((obj0, obj1, obj2)),     h =&gt; obj.ActionEvent += h,     h =&gt; obj.ActionEvent -= h); }<\/code><\/pre>\n<p>2) InteliSense \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e \u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430&nbsp;\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;   &lt;PropertyGroup&gt;     &lt;TargetFramework&gt;netstandard2.0&lt;\/TargetFramework&gt;     &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;   &lt;\/PropertyGroup&gt;   &lt;ItemGroup&gt;     &lt;PackageReference Include=\"Microsoft.CodeAnalysis.Analyzers\" Version=\"3.3.1\"&gt;       &lt;PrivateAssets&gt;all&lt;\/PrivateAssets&gt;       &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;\/IncludeAssets&gt;     &lt;\/PackageReference&gt;     &lt;PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.Workspaces\" Version=\"3.8.0\" \/&gt;   &lt;\/ItemGroup&gt; &lt;\/Project&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c netstandard2.0 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c 2 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.CodeAnalysis.Analyzers\/\" rel=\"noopener noreferrer nofollow\">Microsoft.CodeAnalysis.Analyzers<\/a> \u0438 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.CodeAnalysis.CSharp.Workspaces\/\" rel=\"noopener noreferrer nofollow\">Microsoft.CodeAnalysis.CSharp.Workspaces<\/a>.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;   &lt;PropertyGroup&gt;     &lt;OutputType&gt;Exe&lt;\/OutputType&gt;     &lt;TargetFramework&gt;netcoreapp3.1&lt;\/TargetFramework&gt;     &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;   &lt;\/PropertyGroup&gt;   &lt;ItemGroup&gt;     &lt;PackageReference Include=\"System.Reactive\" Version=\"5.0.0\" \/&gt;   &lt;\/ItemGroup&gt;   &lt;ItemGroup&gt;     &lt;ProjectReference Include=\"..\\SourceGenerator\\RxSourceGenerator.csproj\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" \/&gt;   &lt;\/ItemGroup&gt; &lt;\/Project&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0438\u043d\u0430\u0447\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<pre><code class=\"xml\">&lt;ProjectReference Include=\"..\\SourceGenerator\\RxSourceGenerator.csproj\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" \/&gt;<\/code><\/pre>\n<h3>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430&nbsp;\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p>\u0421\u0430\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>[Generator]<\/code> \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISourceGenerator<\/a>:<\/p>\n<pre><code class=\"cs\">[Generator] public class RxGenerator : ISourceGenerator {     public void Initialize(GeneratorInitializationContext context)  {  }     public void Execute(GeneratorExecutionContext context)  {  } }<\/code><\/pre>\n<p>M\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.initialize?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">Initialize <\/a>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0430 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.execute?view=roslyn-dotnet#Microsoft_CodeAnalysis_ISourceGenerator_Execute_Microsoft_CodeAnalysis_SourceGeneratorContext_\" rel=\"noopener noreferrer nofollow\">Execute <\/a>\u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.initialize?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">Initialize <\/a>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430, \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: <\/p>\n<ul>\n<li>\n<p>\u0444\u0430\u0439\u043b \u043f\u0430\u0440\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441-&gt; <\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>-&gt; <\/p>\n<\/li>\n<li>\n<p>\u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver <\/a>\u043d\u0430\u0434\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430-&gt; <\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.execute?view=roslyn-dotnet#Microsoft_CodeAnalysis_ISourceGenerator_Execute_Microsoft_CodeAnalysis_SourceGeneratorContext_\" rel=\"noopener noreferrer nofollow\">Execute <\/a>\u0436\u0434\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>, \u0438 \u043d\u0430 \u0435\u0433\u043e \u0431\u0430\u0437\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e, \u0442\u043e \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">[Generator] public class RxGenerator : ISourceGenerator {     private const string firstText = @\"using System; using System.Reactive.Linq; namespace RxGenerator{}\";     public void Initialize(GeneratorInitializationContext context)     {         \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c ISyntaxReceiver         context.RegisterForSyntaxNotifications(() =&gt; new SyntaxReceiver());     }     public void Execute(GeneratorExecutionContext context)     {         if (context.SyntaxReceiver is not SyntaxReceiver receiver) return;         \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \"RxGenerator.cs\" \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u0447\u0442\u043e \u0432 firstText         context.AddSource(\"RxGenerator.cs\", fitstText);     }     class SyntaxReceiver : ISyntaxReceiver     {         public void OnVisitSyntaxNode(SyntaxNode syntaxNode)         {         \/\/ \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0434\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.         }     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c VS, \u0442\u043e \u0432 \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>using RxGenerator;<\/code> \u0438 \u043d\u0430 \u043d\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f VS.<\/p>\n<h3>\u041e\u0442\u0431\u043e\u0440 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0432 ISyntaxReceiver<\/h3>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 OnVisitSyntaxNode \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.syntax.memberaccessexpressionsyntax?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">MemberAccessExpressionSyntax<\/a>.<\/p>\n<pre><code class=\"cs\">private class SyntaxReceiver : ISyntaxReceiver {     public List&lt;MemberAccessExpressionSyntax&gt; GenerateCandidates { get; } =         new List&lt;MemberAccessExpressionSyntax&gt;();      public void OnVisitSyntaxNode(SyntaxNode syntaxNode)     {         if (!(syntaxNode is MemberAccessExpressionSyntax syntax)) return;         if (syntax.HasTrailingTrivia || syntax.Name.IsMissing) return;         if (!syntax.Name.ToString().StartsWith(\"Rx\")) return;         GenerateCandidates.Add(syntax);      } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c:<\/p>\n<ul>\n<li>\n<p><code>syntax.Name.IsMissing<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>syntax.HasTrailingTrivia<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><code>!syntax.Name.ToString().StartsWith(\"Rx\")<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u043d\u043e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 &#171;Rx&#187;<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0438 \u043d\u0430\u0434\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435&nbsp;\u0432\u0441\u0435\u0439&nbsp;\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439&nbsp;\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438&nbsp;\u0434\u043b\u044f&nbsp;\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f&nbsp;\u043a\u043b\u0430\u0441\u0441\u0430,&nbsp;\u0434\u043b\u044f&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e&nbsp;\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f&nbsp;\u043c\u0435\u0442\u043e\u0434\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439&nbsp;\u0442\u0438\u043f&nbsp;\u0441\u043e\u0431\u044b\u0442\u0438\u044f.&nbsp;\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,&nbsp;<\/p>\n<p><code>System.Action&lt;System.Int32, System.String, System.Boolean,xSouceGeneratorXUnitTests.SomeEventArgs&gt;<\/code><\/p>\n<\/li>\n<li>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a&nbsp;\u0432\u0441\u0435\u0445&nbsp;\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432&nbsp;\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430&nbsp;\u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"cs\">private static IEnumerable&lt;(string ClassType, string EventName, string EventType, List&lt;string&gt; ArgumentTypes, bool IsStub)&gt;     GetExtensionMethodInfo(GeneratorExecutionContext context, SyntaxReceiver receiver) {     HashSet&lt;(string ClassType, string EventName)&gt;         hashSet = new HashSet&lt;(string ClassType, string EventName)&gt;();     foreach (MemberAccessExpressionSyntax syntax in receiver.GenerateCandidates)     {         SemanticModel model = context.Compilation.GetSemanticModel(syntax.SyntaxTree);         ITypeSymbol? typeSymbol = model.GetSymbolInfo(syntax.Expression).Symbol switch         {             IMethodSymbol s =&gt; s.ReturnType,             ILocalSymbol s =&gt; s.Type,             IPropertySymbol s =&gt; s.Type,             IFieldSymbol s =&gt; s.Type,             IParameterSymbol s =&gt; s.Type,             _ =&gt; null         };         if (typeSymbol == null) continue;  ...<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.semanticmodel?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">SemanticModel<\/a>. \u0418\u0437 \u043d\u0435\u0451 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b. \u0418 \u0432\u043e\u0442 \u043e\u0442\u0442\u0443\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0438\u043f <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.itypesymbol?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ITypeSymbol<\/a>. \u0410 \u0438\u0437 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.itypesymbol?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ITypeSymbol<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"cs\">...         string eventName = syntax.Name.ToString().Substring(2);          if (!(typeSymbol.GetMembersOfType&lt;IEventSymbol&gt;().FirstOrDefault(m =&gt; m.Name == eventName) is { } ev)         ) continue;          if (!(ev.Type is INamedTypeSymbol namedTypeSymbol)) continue;         if (namedTypeSymbol.DelegateInvokeMethod == null) continue;         if (!hashSet.Add((typeSymbol.ToString(), ev.Name))) continue;          string fullType = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat);         List&lt;string&gt; typeArguments = namedTypeSymbol.DelegateInvokeMethod.Parameters             .Select(m =&gt; m.Type.ToDisplayString(SymbolDisplayFormat)).ToList();         yield return (typeSymbol.ToString(), ev.Name, fullType, typeArguments, false);     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430:<\/p>\n<pre><code class=\"cs\">string fullType = namedTypeSymbol.ToDisplayString(symbolDisplayFormat);<\/code><\/pre>\n<p>SymbolDisplayFormat \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0445\u0438\u0442\u0440\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.symboldisplayformat?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">SymbolDisplayFormat <\/a>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.symboldisplay.todisplaystring?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ToDisplayString()<\/a> \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.symboldisplay.todisplaystring?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ToDisplayString() <\/a>\u0432\u043c\u0435\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">System.Action&lt;System.Int32, System.String, System.Boolean, RxSouceGeneratorXUnitTests.SomeEventArgs&gt;<\/code><\/pre>\n<p>\u0432\u0435\u0440\u043d\u0451\u0442<\/p>\n<pre><code class=\"cs\">Action&lt;int, string, bool, SomeEventArgs&gt;<\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u0432 \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043c\u0435\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">List&lt;string&gt; typeArguments = namedTypeSymbol.DelegateInvokeMethod.Parameters.Select(m =&gt; m.Type.ToDisplayString(SymbolDisplayFormat)).ToList();<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0438\u043f\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432 StringBuilder \u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e. <\/p>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.execute?view=roslyn-dotnet#Microsoft_CodeAnalysis_ISourceGenerator_Execute_Microsoft_CodeAnalysis_SourceGeneratorContext_\" rel=\"noopener noreferrer nofollow\">Execute<\/a>:<\/p>\n<details class=\"spoiler\">\n<summary>Spoiler<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public void Execute(GeneratorExecutionContext context) {     if (!(context.SyntaxReceiver is SyntaxReceiver receiver)) return;      if (!(receiver.GenerateCandidates.Any()))     {         context.AddSource(\"RxGenerator.cs\", startText);         return;     }      StringBuilder sb = new StringBuilder();     sb.AppendLine(\"using System;\");     sb.AppendLine(\"using System.Reactive.Linq;\");     sb.AppendLine(\"namespace RxMethodGenerator{\");     sb.AppendLine(\"    public static class RxGeneratedMethods{\");      foreach ((string classType, string eventName, string eventType, List&lt;string&gt; argumentTypes, bool isStub) in GetExtensionMethodInfo(context,         receiver))     {         string tupleTypeStr;         string conversionStr;          switch (argumentTypes.Count)         {             case 0:                 tupleTypeStr = classType;                 conversionStr = \"conversion =&gt; () =&gt; conversion(obj),\";                 break;             case 1:                 tupleTypeStr = argumentTypes.First();                 conversionStr = \"conversion =&gt; obj1 =&gt; conversion(obj1),\";                 break;             default:                 tupleTypeStr =                     $\"({string.Join(\", \", argumentTypes.Select((x, i) =&gt; $\"{x} Item{i + 1}{x.Split('.').Last()}\"))})\";                 string objStr = string.Join(\", \", argumentTypes.Select((x, i) =&gt; $\"obj{i}\"));                 conversionStr = $\"conversion =&gt; ({objStr}) =&gt; conversion(({objStr})),\";                 break;         }          sb.AppendLine(             @$\"        public static IObservable&lt;{tupleTypeStr}&gt; Rx{eventName}(this {classType} obj)\");         sb.AppendLine(@\"        {\");         if (isStub)         {             sb.AppendLine(\"            throw new Exception('RxGenerator stub');\");         }         else         {             sb.AppendLine(\"            if (obj == null) throw new ArgumentNullException(nameof(obj));\");             sb.AppendLine(@$\"            return Observable.FromEvent&lt;{eventType}, {tupleTypeStr}&gt;(\");             sb.AppendLine(@$\"            {conversionStr}\");             sb.AppendLine(@$\"            h =&gt; obj.{eventName} += h,\");             sb.AppendLine(@$\"            h =&gt; obj.{eventName} -= h);\");         }         sb.AppendLine(\"        }\");     }     sb.AppendLine(\"    }\");     sb.AppendLine(\"}\");      context.AddSource(\"RxGenerator.cs\", sb.ToString()); }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435&nbsp;\u0432&nbsp;InteliSense&nbsp;\u043c\u0435\u0442\u043e\u0434\u0430&nbsp;\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435&nbsp;\u0434\u043e&nbsp;\u0435\u0433\u043e&nbsp;\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb InteliSense \u043d\u0430\u043c \u0431\u0443\u0434\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u0436\u0435 \u0435\u0433\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b. \u041d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430 \u0431\u044b\u043b\u0430 \u0432\u0441\u0435\u0433\u0434\u0430. \u042f \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0434\u043b\u044f \u043d\u0438\u0445 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 MS \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0442\u0430\u043a \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0438 \u043e\u0431\u0435\u0449\u0430\u044e\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e\u0448\u0435\u043b \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0435\u043c.<\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.visualstudio.languageserver.protocol.servercapabilities.completionprovider?view=visualstudiosdk-2019\" rel=\"noopener noreferrer nofollow\">CompletionProvider <\/a>\u044d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f InteliSense \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb. \u0421 \u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445 \u043f\u043e\u0440 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 NuGet, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<p>\u0418\u0442\u0430\u043a \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443.<\/p>\n<p>\u0412 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.visualstudio.languageserver.protocol.servercapabilities.completionprovider?view=visualstudiosdk-2019\" rel=\"noopener noreferrer nofollow\">CompletionProvider <\/a>\u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0431\u0438\u0440\u0430\u0435\u0442 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.visualstudio.languageserver.protocol.servercapabilities.completionprovider?view=visualstudiosdk-2019\" rel=\"noopener noreferrer nofollow\">CompletionProvider:<\/a><\/p>\n<pre><code class=\"cs\">public override bool ShouldTriggerCompletion(SourceText text, int caretPosition, CompletionTrigger trigger, OptionSet options) {     switch (trigger.Kind)     {         case CompletionTriggerKind.Insertion:             int insertedCharacterPosition = caretPosition - 1;             if (insertedCharacterPosition &lt;= 0) return false;             char ch = text[insertedCharacterPosition];             char previousCh = text[insertedCharacterPosition - 1];             return ch == '.' &amp;&amp; !char.IsWhiteSpace(previousCh) &amp;&amp; previousCh != '\\t' &amp;&amp; previousCh != '\\r' &amp;&amp; previousCh != '\\n';         default:             return false;     } }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0440\u043a\u0435\u0440 \u00ab.\u00bb \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u0435\u0440\u043d\u0435\u0442 True \u0442\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b InteliSense:<\/p>\n<pre><code class=\"cs\">public override async Task ProvideCompletionsAsync(CompletionContext context) {     SyntaxNode? syntaxNode = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);     if (!(syntaxNode?.FindNode(context.CompletionListSpan) is ExpressionStatementSyntax         expressionStatementSyntax)) return;     if (!(expressionStatementSyntax.Expression is MemberAccessExpressionSyntax syntax)) return;     if (!(await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false) is { }         model)) return;      ITypeSymbol? typeSymbol = model.GetSymbolInfo(syntax.Expression).Symbol switch     {         IMethodSymbol s =&gt; s.ReturnType,         ILocalSymbol s =&gt; s.Type,         IPropertySymbol s =&gt; s.Type,         IFieldSymbol s =&gt; s.Type,         IParameterSymbol s =&gt; s.Type,         _ =&gt; null     };     if (typeSymbol == null) return;      foreach (IEventSymbol ev in typeSymbol.GetMembersOfType&lt;IEventSymbol&gt;())     {         ...                 \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 InteliSense         CompletionItem item = CompletionItem.Create($\"Rx{ev.Name}\");         context.AddItem(item);     } }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d \u0438\u0437 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u043c <strong>\u0432\u0441\u0435 <\/strong>\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0443 \u043f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043d\u0430 \u043d\u0435\u0433\u043e \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u0432 InteliSense:<\/p>\n<pre><code class=\"cs\">public override Task&lt;CompletionDescription&gt; GetDescriptionAsync(Document document, CompletionItem item, CancellationToken cancellationToken) {     return Task.FromResult(CompletionDescription.FromText(\"\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\")); }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 InteliSense \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0432\u0441\u0435, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0431\u0440\u0430\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb \u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public override async Task&lt;CompletionChange&gt; GetChangeAsync(Document document, CompletionItem item,     char? commitKey, CancellationToken cancellationToken) {     string newText = $\".{item.DisplayText}()\";     TextSpan newSpan = new TextSpan(item.Span.Start - 1, 1);      TextChange textChange = new TextChange(newSpan, newText);     return await Task.FromResult(CompletionChange.Create(textChange)); }<\/code><\/pre>\n<p>\u0412\u0441\u0451!<\/p>\n<h3>\u0413\u0434\u0435&nbsp;\u0438&nbsp;\u043a\u0430\u043a&nbsp;\u044d\u0442\u043e&nbsp;\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h3>\n<p>\u0412\u0441\u0435 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Visual Studio \u211616.8.3. \u041d\u0430 <a href=\"https:\/\/github.com\/Zalutskii\/Reactive-Extensions-event-generator\" rel=\"noopener noreferrer nofollow\">GitHab <\/a>\u0435\u0441\u0442\u044c \u0433\u0438\u0444\u043a\u0430 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 Visual Studio. \u0412 Rider \u0438 ReSharper \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c ReSharper \u043f\u0435\u0440\u0435\u0434 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0421\u0430\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043a\u0438 \u0438\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u044d\u0442\u043e \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b. \u041d\u0430 WPF \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u044d\u0442\u043e\u0442 \u0431\u0430\u0433 \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0430 GitHab Roslyn.<\/p>\n<p>\u0414\u043b\u044f <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.visualstudio.languageserver.protocol.servercapabilities.completionprovider?view=visualstudiosdk-2019\" rel=\"noopener noreferrer nofollow\">CompletionProvider <\/a>\u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u0430\u043a Vsix \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043a\u0430\u043a NuGet \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u042f \u0441\u0434\u0435\u043b\u0430\u043b \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u0435\u0449\u0435 using \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c, \u043d\u043e \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043f\u043e\u043a\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f NuGet.<\/p>\n<h3>\u041a\u0430\u043a&nbsp;\u044d\u0442\u043e&nbsp;\u0432\u0441\u0435&nbsp;\u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c<\/h3>\n<p>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043c\u0435\u0442\u043e\u0434 Initialize \u0441\u0442\u0440\u043e\u0447\u043a\u0443 <code>Debugger.Launch();<\/code> \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c VS<\/p>\n<pre><code class=\"cs\">public override async Task&lt;CompletionChange&gt; GetChangeAsync(Document document, CompletionItem item,     char? commitKey, CancellationToken cancellationToken) { public void Initialize(GeneratorInitializationContext context) {     #if (DEBUG)     Debugger.Launch();     #endif     context.RegisterForSyntaxNotifications(() =&gt; new SyntaxReceiver()); }<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u043e\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u0441\u044b\u0440\u0430\u044f. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0439\u0442\u0435 VS, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442. <\/p>\n<p>\u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.visualstudio.languageserver.protocol.servercapabilities.completionprovider?view=visualstudiosdk-2019\" rel=\"noopener noreferrer nofollow\">CompletionProvider <\/a>\u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0432 VS \u00abAnalyzer with code Fix\u00bb. \u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 Vsix. \u041e\u043d \u0431\u0443\u0434\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0443\u0434\u0438\u044e \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c CompletionProvider \u043a\u0430\u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0442\u044c. <\/p>\n<h3>\u041a\u0440\u0430\u0442\u043a\u0438\u0439&nbsp;\u0432\u044b\u0432\u043e\u0434<\/h3>\n<p>\u041a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0443\u043c\u0435\u0441\u0442\u0438\u043b\u0441\u044f \u0432 140 \u0441\u0442\u0440\u043e\u043a. \u0417\u0430 \u044d\u0442\u0438 140 \u0441\u0442\u0440\u043e\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u044f\u0437\u044b\u043a\u0430, \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0438\u0445 \u043d\u0430 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a> \u0441 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c. \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. <\/p>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p><a href=\"https:\/\/www.nuget.org\/packages\/RxSourceGenerator\" rel=\"noopener noreferrer nofollow\">NuGet<\/a><\/p>\n<p><a href=\"https:\/\/github.com\/Zalutskii\/Reactive-Extensions-event-generator\" rel=\"noopener noreferrer nofollow\">GitHab<\/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\/post\/533128\/\"> https:\/\/habr.com\/ru\/post\/533128\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0418\u0432\u0430\u043d \u0438 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a. <\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u0440\u043e\u0448\u043b\u0430 \u043f\u0440\u0438\u0443\u0440\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043a \u0432\u044b\u0445\u043e\u0434\u0443 .NET 5 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u044f .NETConf 2020. \u041d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u0434\u0438\u043d \u0438\u0437 \u0434\u043e\u043a\u043b\u0430\u0434\u0447\u0438\u043a\u043e\u0432 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b \u043f\u0440\u043e <a href=\"https:\/\/www.youtube.com\/watch?v=3YwwdoRg2F4\" rel=\"noopener noreferrer nofollow\">C# Source Generators<\/a>. \u041f\u043e\u0438\u0441\u043a\u0430\u0432 \u043d\u0430 youtube \u043d\u0430\u0448\u0435\u043b \u0435\u0449\u0435 <a href=\"https:\/\/www.youtube.com\/watch?v=zHYd9o7-wlw\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435 \u0432\u0438\u0434\u0435\u043e \u043f\u043e \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435<\/a>. \u0421\u043e\u0432\u0435\u0442\u0443\u044e \u0438\u0445 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c. \u0412 \u043d\u0438\u0445 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u0434, \u0430 InteliSense \u0442\u0443\u0442 \u0436\u0435 \u043f\u043e\u0434\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0435 \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0438\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435. \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u044f\u0437\u044b\u043a\u0430 \u0438 \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u044d\u0442\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h3>\u0418\u0434\u0435\u044f<\/h3>\n<p>\u0412\u0441\u0435 \u0436\u0435 \u0437\u043d\u0430\u044e\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/concepts\/linq\/\" rel=\"noopener noreferrer nofollow\">LINQ<\/a>? \u0422\u0430\u043a \u0432\u043e\u0442 \u0434\u043b\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0435\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0432\u0438\u0434\u0435, \u0447\u0442\u043e \u0438 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/programming-guide\/concepts\/linq\/\" rel=\"noopener noreferrer nofollow\">LINQ <\/a>\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a> \u043d\u0430\u0434\u043e \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043e\u0444\u043e\u0440\u043c\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 Reactive Extensions, \u0430 \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0442\u043e \u0438 Reactive Extensions \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u0434\u043e\u0431\u043d\u043e. \u0415\u0441\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f C# \u0432 \u0432\u0438\u0434 Reactive Extensions. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d \u0442\u0430\u043a. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c:<\/p>\n<pre><code class=\"cs\">public partial class Example {     public event Action&lt;int, string, bool&gt; ActionEvent; }<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u044d\u0442\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u0438\u043b\u0435 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"cs\">public static IObservable&lt;(int, string, bool)&gt; RxActionEvent(this TestConsoleApp.Example obj) {     if (obj == null) throw new ArgumentNullException(nameof(obj));     return Observable.FromEvent&lt;System.Action&lt;int, string, bool&gt;, (int, string, bool)&gt;(     conversion =&gt; (obj0, obj1, obj2) =&gt; conversion((obj0, obj1, obj2)),     h =&gt; obj.ActionEvent += h,     h =&gt; obj.ActionEvent -= h); }<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u043f\u043b\u044e\u0441\u0430\u043c\u0438 <a href=\"https:\/\/github.com\/dotnet\/reactive\" rel=\"noopener noreferrer nofollow\">Reactive Extensions<\/a>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">var example = new  Example(); example.RxActionEvent().Where(obj =&gt; obj.Item1 &gt; 10).Take(1).Subscribe((obj)=&gt; { \/* some action  *\/});<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0432\u043e\u0442, \u0438\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0441\u0442\u044b\u043b\u044c \u044d\u0442\u043e\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0441\u044f \u0441\u0430\u043c, \u0430 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438\u0437 InteliSense \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>1)&nbsp;\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u0434\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u043a\u0435\u0440\u0430 \u00ab.\u00bb \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043a \u0447\u043b\u0435\u043d\u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043c\u0435\u0442\u043e\u0434\u0443 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u043c\u0443\u0441\u044f \u043d\u0430 \u00abRx\u00bb, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>example.RxActionEvent()<\/code>, \u0430 \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0441\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 Action ActionEvent, \u0430 \u0432 \u043a\u043e\u0434\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <code>.RxActionEvent()<\/code>, \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public static IObservable&lt;(System.Int32 Item1Int32, System.String Item2String, System.Boolean Item3Boolean)&gt; RxActionEvent(this TestConsoleApp.Example obj) {     if (obj == null) throw new ArgumentNullException(nameof(obj));     return Observable.FromEvent&lt;System.Action&lt;System.Int32, System.String, System.Boolean&gt;, (System.Int32 Item1Int32, System.String Item2String, System.Boolean  Item3Boolean)&gt;(     conversion =&gt; (obj0, obj1, obj2) =&gt; conversion((obj0, obj1, obj2)),     h =&gt; obj.ActionEvent += h,     h =&gt; obj.ActionEvent -= h); }<\/code><\/pre>\n<p>2) InteliSense \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e \u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h3>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430&nbsp;\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432<\/h3>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c 2 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;   &lt;PropertyGroup&gt;     &lt;TargetFramework&gt;netstandard2.0&lt;\/TargetFramework&gt;     &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;   &lt;\/PropertyGroup&gt;   &lt;ItemGroup&gt;     &lt;PackageReference Include=\"Microsoft.CodeAnalysis.Analyzers\" Version=\"3.3.1\"&gt;       &lt;PrivateAssets&gt;all&lt;\/PrivateAssets&gt;       &lt;IncludeAssets&gt;runtime; build; native; contentfiles; analyzers; buildtransitive&lt;\/IncludeAssets&gt;     &lt;\/PackageReference&gt;     &lt;PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.Workspaces\" Version=\"3.8.0\" \/&gt;   &lt;\/ItemGroup&gt; &lt;\/Project&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c netstandard2.0 \u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c 2 \u043f\u0430\u043a\u0435\u0442\u0430 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.CodeAnalysis.Analyzers\/\" rel=\"noopener noreferrer nofollow\">Microsoft.CodeAnalysis.Analyzers<\/a> \u0438 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.CodeAnalysis.CSharp.Workspaces\/\" rel=\"noopener noreferrer nofollow\">Microsoft.CodeAnalysis.CSharp.Workspaces<\/a>.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;   &lt;PropertyGroup&gt;     &lt;OutputType&gt;Exe&lt;\/OutputType&gt;     &lt;TargetFramework&gt;netcoreapp3.1&lt;\/TargetFramework&gt;     &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;   &lt;\/PropertyGroup&gt;   &lt;ItemGroup&gt;     &lt;PackageReference Include=\"System.Reactive\" Version=\"5.0.0\" \/&gt;   &lt;\/ItemGroup&gt;   &lt;ItemGroup&gt;     &lt;ProjectReference Include=\"..\\SourceGenerator\\RxSourceGenerator.csproj\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" \/&gt;   &lt;\/ItemGroup&gt; &lt;\/Project&gt;<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u0438\u043d\u0430\u0447\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442:<\/p>\n<pre><code class=\"xml\">&lt;ProjectReference Include=\"..\\SourceGenerator\\RxSourceGenerator.csproj\" ReferenceOutputAssembly=\"false\" OutputItemType=\"Analyzer\" \/&gt;<\/code><\/pre>\n<h3>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430&nbsp;\u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p>\u0421\u0430\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>[Generator]<\/code> \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISourceGenerator<\/a>:<\/p>\n<pre><code class=\"cs\">[Generator] public class RxGenerator : ISourceGenerator {     public void Initialize(GeneratorInitializationContext context)  {  }     public void Execute(GeneratorExecutionContext context)  {  } }<\/code><\/pre>\n<p>M\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.initialize?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">Initialize <\/a>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0430 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.execute?view=roslyn-dotnet#Microsoft_CodeAnalysis_ISourceGenerator_Execute_Microsoft_CodeAnalysis_SourceGeneratorContext_\" rel=\"noopener noreferrer nofollow\">Execute <\/a>\u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.initialize?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">Initialize <\/a>\u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430, \u0437\u0434\u0435\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: <\/p>\n<ul>\n<li>\n<p>\u0444\u0430\u0439\u043b \u043f\u0430\u0440\u0441\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441-&gt; <\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>-&gt; <\/p>\n<\/li>\n<li>\n<p>\u0432 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver <\/a>\u043d\u0430\u0434\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430-&gt; <\/p>\n<\/li>\n<li>\n<p>\u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator.execute?view=roslyn-dotnet#Microsoft_CodeAnalysis_ISourceGenerator_Execute_Microsoft_CodeAnalysis_SourceGeneratorContext_\" rel=\"noopener noreferrer nofollow\">Execute <\/a>\u0436\u0434\u0435\u043c \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0434\u0435\u0442 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isyntaxreceiver?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ISyntaxReceiver<\/a>, \u0438 \u043d\u0430 \u0435\u0433\u043e \u0431\u0430\u0437\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0437\u0432\u0443\u0447\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e, \u0442\u043e \u043a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">[Generator] public class RxGenerator : ISourceGenerator {     private const string firstText = @\"using System; using System.Reactive.Linq; namespace RxGenerator{}\";     public void Initialize(GeneratorInitializationContext context)     {         \/\/ \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c ISyntaxReceiver         context.RegisterForSyntaxNotifications(() =&gt; new SyntaxReceiver());     }     public void Execute(GeneratorExecutionContext context)     {         if (context.SyntaxReceiver is not SyntaxReceiver receiver) return;         \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \"RxGenerator.cs\" \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u043c, \u0447\u0442\u043e \u0432 firstText         context.AddSource(\"RxGenerator.cs\", fitstText);     }     class SyntaxReceiver : ISyntaxReceiver     {         public void OnVisitSyntaxNode(SyntaxNode syntaxNode)         {         \/\/ \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0434\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430.         }     } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0434\u0438\u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c VS, \u0442\u043e \u0432 \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>using RxGenerator;<\/code> \u0438 \u043d\u0430 \u043d\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0443\u0433\u0430\u0442\u044c\u0441\u044f VS.<\/p>\n<h3>\u041e\u0442\u0431\u043e\u0440 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 \u0432 ISyntaxReceiver<\/h3>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 OnVisitSyntaxNode \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.syntax.memberaccessexpressionsyntax?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">MemberAccessExpressionSyntax<\/a>.<\/p>\n<pre><code class=\"cs\">private class SyntaxReceiver : ISyntaxReceiver {     public List&lt;MemberAccessExpressionSyntax&gt; GenerateCandidates { get; } =         new List&lt;MemberAccessExpressionSyntax&gt;();      public void OnVisitSyntaxNode(SyntaxNode syntaxNode)     {         if (!(syntaxNode is MemberAccessExpressionSyntax syntax)) return;         if (syntax.HasTrailingTrivia || syntax.Name.IsMissing) return;         if (!syntax.Name.ToString().StartsWith(\"Rx\")) return;         GenerateCandidates.Add(syntax);      } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c:<\/p>\n<ul>\n<li>\n<p><code>syntax.Name.IsMissing<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438<\/p>\n<\/li>\n<li>\n<p><code>syntax.HasTrailingTrivia<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><code>!syntax.Name.ToString().StartsWith(\"Rx\")<\/code> \u044d\u0442\u043e \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u043e\u0447\u043a\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u043d\u043e \u043c\u0435\u0442\u043e\u0434 \u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 &#171;Rx&#187;<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u0441\u043b\u0443\u0447\u0430\u0438 \u043d\u0430\u0434\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435&nbsp;\u0432\u0441\u0435\u0439&nbsp;\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439&nbsp;\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438&nbsp;\u0434\u043b\u044f&nbsp;\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f&nbsp;\u043a\u043b\u0430\u0441\u0441\u0430,&nbsp;\u0434\u043b\u044f&nbsp;\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e&nbsp;\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f&nbsp;\u043c\u0435\u0442\u043e\u0434\u044b<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439&nbsp;\u0442\u0438\u043f&nbsp;\u0441\u043e\u0431\u044b\u0442\u0438\u044f.&nbsp;\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440,&nbsp;<\/p>\n<p><code>System.Action&lt;System.Int32, System.String, System.Boolean,xSouceGeneratorXUnitTests.SomeEventArgs&gt;<\/code><\/p>\n<\/li>\n<li>\n<p>\u0421\u043f\u0438\u0441\u043e\u043a&nbsp;\u0432\u0441\u0435\u0445&nbsp;\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432&nbsp;\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430&nbsp;\u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"cs\">private static IEnumerable&lt;(string ClassType, string EventName, string EventType, List&lt;string&gt; ArgumentTypes, bool IsStub)&gt;     GetExtensionMethodInfo(GeneratorExecutionContext context, SyntaxReceiver receiver) {     HashSet&lt;(string ClassType, string EventName)&gt;         hashSet = new HashSet&lt;(string ClassType, string EventName)&gt;();     foreach (MemberAccessExpressionSyntax syntax in receiver.GenerateCandidates)     {         SemanticModel model = context.Compilation.GetSemanticModel(syntax.SyntaxTree);         ITypeSymbol? typeSymbol = model.GetSymbolInfo(syntax.Expression).Symbol switch         {             IMethodSymbol s =&gt; s.ReturnType,             ILocalSymbol s =&gt; s.Type,             IPropertySymbol s =&gt; s.Type,             IFieldSymbol s =&gt; s.Type,             IParameterSymbol s =&gt; s.Type,             _ =&gt; null         };         if (typeSymbol == null) continue;  ...<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.semanticmodel?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">SemanticModel<\/a>. \u0418\u0437 \u043d\u0435\u0451 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b. \u0418 \u0432\u043e\u0442 \u043e\u0442\u0442\u0443\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0438\u043f <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.itypesymbol?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ITypeSymbol<\/a>. \u0410 \u0438\u0437 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.itypesymbol?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ITypeSymbol<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"cs\">...         string eventName = syntax.Name.ToString().Substring(2);          if (!(typeSymbol.GetMembersOfType&lt;IEventSymbol&gt;().FirstOrDefault(m =&gt; m.Name == eventName) is { } ev)         ) continue;          if (!(ev.Type is INamedTypeSymbol namedTypeSymbol)) continue;         if (namedTypeSymbol.DelegateInvokeMethod == null) continue;         if (!hashSet.Add((typeSymbol.ToString(), ev.Name))) continue;          string fullType = namedTypeSymbol.ToDisplayString(SymbolDisplayFormat);         List&lt;string&gt; typeArguments = namedTypeSymbol.DelegateInvokeMethod.Parameters             .Select(m =&gt; m.Type.ToDisplayString(SymbolDisplayFormat)).ToList();         yield return (typeSymbol.ToString(), ev.Name, fullType, typeArguments, false);     } }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430:<\/p>\n<pre><code class=\"cs\">string fullType = namedTypeSymbol.ToDisplayString(symbolDisplayFormat);<\/code><\/pre>\n<p>SymbolDisplayFormat \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0445\u0438\u0442\u0440\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.symboldisplayformat?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">SymbolDisplayFormat <\/a>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0443 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.symboldisplay.todisplaystring?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ToDisplayString()<\/a> \u0432 \u043a\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e. \u0411\u0435\u0437 \u043d\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.csharp.symboldisplay.todisplaystring?view=roslyn-dotnet\" rel=\"noopener noreferrer nofollow\">ToDisplayS<\/a><\/p>\n<\/div>\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-314878","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314878","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=314878"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/314878\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=314878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=314878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=314878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}