{"id":313999,"date":"2020-11-29T21:00:45","date_gmt":"2020-11-29T21:00:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313999"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313999","title":{"rendered":"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f AvaloniaUI \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c x:Name \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e C# Source Generators API"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/6759207\/100546602-4b3f4e80-3273-11eb-9286-3eb7d305f382.png\"\/>  <\/p>\n<p>  \u0412 \u0430\u043f\u0440\u0435\u043b\u0435 2020-\u0433\u043e \u0433\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET 5 <a href=\"https:\/\/habr.com\/ru\/post\/503172\/\">\u0431\u044b\u043b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d<\/a> \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C# \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator?view=roslyn-dotnet\" rel=\"nofollow\"><code>ISourceGenerator<\/code><\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0438 <a href=\"https:\/\/blog.jetbrains.com\/dotnet\/2020\/11\/12\/source-generators-in-net-5-with-resharper\/\" rel=\"nofollow\">\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/a> \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, API \u043d\u043e\u0432\u044b\u0445 \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\u0445\u043e\u0436 \u0441 API <a href=\"https:\/\/habr.com\/ru\/post\/455952\/\">\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 Roslyn<\/a>. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/blog.zwezdin.com\/2013\/code-generating-with-roslyn\/\" rel=\"nofollow\">Roslyn Compiler API<\/a>, \u0442\u0430\u043a \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"postanovka-zadachi\">\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u043e\u0432\u044b\u0445 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0448\u0438\u0440\u043e\u043a\u0438\u0439 \u0441\u043f\u0435\u043a\u0442\u0440 \u0437\u0430\u0434\u0430\u0447, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 <a href=\"http:\/\/avaloniaui.net\/\" rel=\"nofollow\">AvaloniaUI<\/a> \u2014 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0434\u0430\u0432\u043d\u043e <a href=\"https:\/\/habr.com\/ru\/company\/skbkontur\/blog\/524518\/\">\u0432\u044b\u0448\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0430 \u0425\u0430\u0431\u0440\u0435<\/a> \u2014 \u043d\u0435\u0440\u0435\u0434\u043a\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 XAML:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">TextBox PasswordTextBox =&gt; this.FindControl&lt;TextBox&gt;(&quot;PasswordTextBox&quot;);<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u0438\u043f\u0430 <code>TextBox<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>PasswordTextBox<\/code> \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d \u0432 XAML \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;TextBox x:Name=&quot;PasswordTextBox&quot;          Watermark=&quot;Please, enter your password...&quot;          UseFloatingWatermark=&quot;True&quot;          PasswordChar=&quot;*&quot; \/&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 XAML \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0439, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u0432\u044f\u0437\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 ReactiveUI, \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a <a href=\"https:\/\/www.reactiveui.net\/docs\/handbook\/data-binding\/#types-of-bindings\" rel=\"nofollow\"><code>Bind<\/code><\/a>, <a href=\"https:\/\/www.reactiveui.net\/docs\/handbook\/data-binding\/#types-of-bindings\" rel=\"nofollow\"><code>BindCommand<\/code><\/a>, <a href=\"https:\/\/github.com\/reactiveui\/reactiveui.validation\" rel=\"nofollow\"><code>BindValidation<\/code><\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b View \u0438 ViewModel \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 <code>{Binding}<\/code> \u0432 XAML-\u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public class SignUpView : ReactiveWindow&lt;SignUpViewModel&gt; {     public SignUpView()     {         AvaloniaXamlLoader.Load(this);          \/\/ \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 ReactiveUI \u0438 ReactiveUI.Validation.         \/\/ \u041c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0445\u043e\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Binding,         \/\/ \u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438 \u0432 C#.         \/\/ \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u0442\u044c \u0438\u043c (\u0438 \u043c\u043d\u043e\u0433\u0438\u043c \u0434\u0440\u0443\u0433\u0438\u043c) \u0436\u0438\u0437\u043d\u044c?         \/\/         this.Bind(ViewModel, x =&gt; x.Username, x =&gt; x.UserNameTextBox.Text);         this.Bind(ViewModel, x =&gt; x.Password, x =&gt; x.PasswordTextBox.Text);         this.BindValidation(ViewModel, x =&gt; x.CompoundValidation.Text);     }      \/\/ \u0428\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c     \/\/ \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432 XAML.     TextBox UserNameTextBox =&gt; this.FindControl&lt;TextBox&gt;(&quot;UserNameTextBox&quot;);     TextBox PasswordTextBox =&gt; this.FindControl&lt;TextBox&gt;(&quot;PasswordTextBox&quot;);     TextBlock CompoundValidation =&gt; this.FindControl&lt;TextBlock&gt;(&quot;CompoundValidation&quot;); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437 XAML-\u0444\u0430\u0439\u043b\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e <code>SignUpView<\/code>, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u043c. \u0411\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434, \u0447\u0442\u043e\u0431\u044b, \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u043e\u0441\u0442\u0438, \u0430 \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u2014 \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u0432 \u0438\u043c\u0435\u043d\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0432 XAML, \u0438\u043b\u0438 \u0432 \u0438\u043c\u0435\u043d\u0438 \u0435\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0441\u0451 \u0432\u0440\u0435\u043c\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435, \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0438\u043c\u0451\u043d \u0438 \u0442\u0438\u043f\u043e\u0432 \u0432 XAML-\u0444\u0430\u0439\u043b\u0435, \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430\u0445 \u043c\u044b \u0431\u044b \u0443\u0437\u043d\u0430\u0432\u0430\u043b\u0438 \u0443\u0436\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0438 \u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0431\u044b \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u043a\u0430\u043a, \u0432\u043f\u0440\u043e\u0447\u0435\u043c, \u0438 \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u0438\u0445 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432).<\/p>\n<p>  <\/p>\n<h3 id=\"primer-vhodnyh-i-vyhodnyh-dannyh\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u041c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0430\u0448 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430. \u0414\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>SignUpView<\/code>, \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f XAML-\u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0430 <code>SignUpView.xaml<\/code>, \u0438 code-behind \u0444\u0430\u0439\u043b <code>SignUpView.xaml.cs<\/code>, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043b\u043e\u0433\u0438\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>SignUpView.xaml<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;Window xmlns=&quot;https:\/\/github.com\/avaloniaui&quot;         xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;         x:Class=&quot;Avalonia.NameGenerator.Sandbox.Views.SignUpView&quot;&gt;     &lt;StackPanel&gt;         &lt;TextBox x:Name=&quot;UserNameTextBox&quot;                  Watermark=&quot;Please, enter user name...&quot;                  UseFloatingWatermark=&quot;True&quot; \/&gt;         &lt;TextBlock Name=&quot;UserNameValidation&quot;                    Foreground=&quot;Red&quot;                    FontSize=&quot;12&quot; \/&gt;     &lt;\/StackPanel&gt; &lt;\/Window&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 <code>SignUpView.xaml.cs<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \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\">public partial class SignUpView : Window {     public SignUpView()     {         AvaloniaXamlLoader.Load(this);         \/\/ \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c,         \/\/ \u0447\u0442\u043e\u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0433\u043e:         \/\/ UserNameTextBox.Text = &quot;Violet Evergarden&quot;;         \/\/ UserNameValidation.Text = &quot;An optional validation error message&quot;;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>SignUpView.xaml.cs<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \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\">partial class SignUpView {     internal global::Avalonia.Controls.TextBox UserNameTextBox =&gt; this.FindControl&lt;global::Avalonia.Controls.TextBox&gt;(&quot;UserNameTextBox&quot;);     internal global::Avalonia.Controls.TextBlock UserNameValidation =&gt; this.FindControl&lt;global::Avalonia.Controls.TextBlock&gt;(&quot;UserNameValidation&quot;); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0444\u0438\u043a\u0441\u044b <code>global::<\/code> \u0437\u0434\u0435\u0441\u044c \u043d\u0443\u0436\u043d\u044b \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432 \u0438\u043c\u0451\u043d. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0442\u0438\u043f\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 WPF, \u043c\u044b \u043c\u0430\u0440\u043a\u0438\u0440\u0443\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u0430\u043a <code>internal<\/code>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>partial<\/code>-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0447\u0430\u0441\u0442\u0435\u0439 <code>partial<\/code>-\u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u044b \u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u2014 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u0430\u043a\u043e\u0433\u043e \u0443\u0433\u043e\u0434\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430 <code>Window<\/code>, \u0431\u0443\u0434\u044c \u0442\u043e <code>ReactiveWindow&lt;TViewModel&gt;<\/code>, \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f \u043e\u043a\u043d\u0430.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <code>FindControl<\/code> \u043e\u0431\u0445\u043e\u0434 \u0434\u0435\u0440\u0435\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u2014 Avalonia \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 <code>INameScope<\/code> \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u0438 Avalonia. \u041f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438, \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 <a href=\"https:\/\/github.com\/AvaloniaUI\/Avalonia\/blob\/15968cb2c0aa115545e6766ee321ffd9eaa6d8d0\/src\/Avalonia.Controls\/ControlExtensions.cs#L54\" rel=\"nofollow\">FindControl<\/a> \u0438 <a href=\"https:\/\/github.com\/AvaloniaUI\/Avalonia\/blob\/15968cb2c0aa115545e6766ee321ffd9eaa6d8d0\/src\/Avalonia.Styling\/Controls\/NameScopeExtensions.cs#L108\" rel=\"nofollow\">FindNameScope<\/a> \u043d\u0430 GitHub.<\/p>\n<p>  <\/p>\n<h3 id=\"realizuem-interfeys-isourcegenerator\">\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>ISourceGenerator<\/code><\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 <a href=\"https:\/\/blog.jetbrains.com\/dotnet\/2020\/11\/12\/source-generators-in-net-5-with-resharper\/\" rel=\"nofollow\">\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">[Generator] public class EmptyGenerator : ISourceGenerator {     public void Initialize(GeneratorInitializationContext context) { }      public void Execute(GeneratorExecutionContext context) { } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Initialize<\/code> \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Execute<\/code> \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>context.AddSource(fileName, sourceText)<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\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<p>  <\/p>\n<pre><code class=\"xml\">&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;     &lt;PropertyGroup&gt;         &lt;TargetFramework&gt;netstandard2.0&lt;\/TargetFramework&gt;         &lt;LangVersion&gt;preview&lt;\/LangVersion&gt;         &lt;GeneratePackageOnBuild&gt;true&lt;\/GeneratePackageOnBuild&gt;         &lt;IncludeBuildOutput&gt;false&lt;\/IncludeBuildOutput&gt;     &lt;\/PropertyGroup&gt;     &lt;ItemGroup&gt;         &lt;PackageReference             Include=&quot;Microsoft.CodeAnalysis.CSharp&quot;             Version=&quot;3.8.0-5.final&quot;             PrivateAssets=&quot;all&quot; \/&gt;         &lt;PackageReference             Include=&quot;Microsoft.CodeAnalysis.Analyzers&quot;             Version=&quot;3.3.1&quot;             PrivateAssets=&quot;all&quot; \/&gt;     &lt;\/ItemGroup&gt;     &lt;ItemGroup&gt;         &lt;None Include=&quot;$(OutputPath)\\$(AssemblyName).dll&quot;               Pack=&quot;true&quot;               PackagePath=&quot;analyzers\/dotnet\/cs&quot;               Visible=&quot;false&quot; \/&gt;     &lt;\/ItemGroup&gt; &lt;\/Project&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0431\u043e\u0440\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441\u0441\u044b\u043b\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f Avalonia, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 XAML. \u0418\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \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\">[Generator] public class NameReferenceGenerator : ISourceGenerator {     private const string AttributeName = &quot;GenerateTypedNameReferencesAttribute&quot;;     private const string AttributeFile = &quot;GenerateTypedNameReferencesAttribute&quot;;     private const string AttributeCode = @&quot;\/\/ &lt;auto-generated \/&gt; using System; [AttributeUsage(AttributeTargets.Class, Inherited=false, AllowMultiple=false)] internal sealed class GenerateTypedNameReferencesAttribute : Attribute { } &quot;;      public void Initialize(GeneratorInitializationContext context) { }      public void Execute(GeneratorExecutionContext context)     {         \/\/ \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043e\u0434 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b 'GenerateTypedNameReferencesAttribute.cs'          \/\/ \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0448\u0438\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c.         context.AddSource(AttributeFile,             SourceText.From(                 AttributeCode, Encoding.UTF8));     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u2014 \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430, \u0438 \u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u043a\u0430\u043a \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 <code>SourceText.From(code)<\/code> \u043e\u0431\u0435\u0440\u043d\u0443\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0438 \u0437\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 <code>context.AddSource(fileName, sourceText)<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0430\u0448 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u043a\u043b\u0430\u0441\u0441\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>[GenerateTypedNameReferences]<\/code>. \u0414\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 XAML. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0441 <code>SignUpView.xaml<\/code>, code-behind \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">[GenerateTypedNameReferences] public partial class SignUpView : Window {     public SignUpView()     {         AvaloniaXamlLoader.Load(this);         \/\/ \u041c\u044b \u043f\u043e\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438.         \/\/ \u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435, \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f (\u043f\u043e\u043a\u0430).         \/\/ UserNameTextBox.Text = &quot;Violet Evergarden&quot;;         \/\/ UserNameValidation.Text = &quot;An optional validation error message&quot;;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043d\u0430\u0448 <code>ISourceGenerator<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0432\u0435\u0449\u0430\u043c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>[GenerateTypedNameReferences]<\/code>;<\/li>\n<li>\u041d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430\u043c XAML-\u0444\u0430\u0439\u043b\u044b;<\/li>\n<li>\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0442\u0438\u043f\u043e\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 XAML-\u0444\u0430\u0439\u043b\u0430\u0445;<\/li>\n<li>\u0412\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0438\u0437 XAML-\u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u043c\u0435\u043d\u0430 (\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>Name<\/code> \u0438\u043b\u0438 <code>x:Name<\/code>) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f;<\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>partial<\/code>-\u043a\u043b\u0430\u0441\u0441 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"nahodim-klassy-markirovannye-atributom\">\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043a\u043b\u0430\u0441\u0441\u044b, \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 API \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\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>ISyntaxReceiver<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c <code>ISyntaxReceiver<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">internal class NameReferenceSyntaxReceiver : ISyntaxReceiver {     public List&lt;ClassDeclarationSyntax&gt; CandidateClasses { get; } =         new List&lt;ClassDeclarationSyntax&gt;();      public void OnVisitSyntaxNode(SyntaxNode syntaxNode)     {         if (syntaxNode is ClassDeclarationSyntax classDeclarationSyntax &amp;&amp;             classDeclarationSyntax.AttributeLists.Count &gt; 0)             CandidateClasses.Add(classDeclarationSyntax);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>ISourceGenerator.Initialize(GeneratorInitializationContext context)<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">context.RegisterForSyntaxNotifications(() =&gt; new NameReferenceSyntaxReceiver());<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c <code>ClassDeclarationSyntax<\/code> \u0432 \u0441\u0431\u043e\u0440\u043a\u0435, \u0438 \u0432 \u0446\u0438\u043a\u043b\u0435 \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 CSharpCompilation \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. var options = (CSharpParseOptions)existingCompilation.SyntaxTrees[0].Options; var compilation = existingCompilation.AddSyntaxTrees(CSharpSyntaxTree     .ParseText(SourceText.From(AttributeCode, Encoding.UTF8), options));  var attributeSymbol = compilation.GetTypeByMetadataName(AttributeName); var symbols = new List&lt;INamedTypeSymbol&gt;(); foreach (var candidateClass in nameReferenceSyntaxReceiver.CandidateClasses) {     \/\/ \u0418\u0437\u0432\u043b\u0435\u0447\u0451\u043c INamedTypeSymbol \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430-\u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u0430.     var model = compilation.GetSemanticModel(candidateClass.SyntaxTree);     var typeSymbol = (INamedTypeSymbol) model.GetDeclaredSymbol(candidateClass);      \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043b\u0438 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430.     var relevantAttribute = typeSymbol!         .GetAttributes()         .FirstOrDefault(attr =&gt; attr.AttributeClass!.Equals(             attributeSymbol, SymbolEqualityComparer.Default));      if (relevantAttribute == null) {         continue;     }      \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u043b\u0438 \u043a\u043b\u0430\u0441\u0441 \u043a\u0430\u043a 'partial'.     var isPartial = candidateClass         .Modifiers         .Any(modifier =&gt; modifier.IsKind(SyntaxKind.PartialKeyword));      \/\/ \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043f\u0438\u0441\u043e\u043a 'symbols' \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435     \/\/ \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0430\u0440\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 'partial'     \/\/ \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 'GenerateTypedNameReferences'.     if (isPartial) {         symbols.Add(typeSymbol);     } }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nahodim-podhodyaschie-xaml-fayly\">\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 XAML-\u0444\u0430\u0439\u043b\u044b<\/h3>\n<p>  <\/p>\n<p>\u0412 Avalonia \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f XAML-\u0444\u0430\u0439\u043b\u043e\u0432 \u0438 code-behind \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0445. \u0414\u043b\u044f \u0444\u0430\u0439\u043b\u0430 \u0441 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u043e\u0439 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>SignUpView.xaml<\/code> \u0444\u0430\u0439\u043b code-behind \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <code>SignUpView.xaml.cs<\/code>, \u0430 \u043a\u043b\u0430\u0441\u0441 \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0435\u0433\u043e, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>SignUpView<\/code>. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f. \u0424\u0430\u0439\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 Avalonia \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u043c\u043e\u0433\u043b\u0438 \u0438\u043c\u0435\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <code>.xaml<\/code> \u0438\u043b\u0438 <code>.axaml<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u043c\u044f XAML-\u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043c\u0435\u043d\u0438 \u0442\u0438\u043f\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var xamlFileName = $&quot;{typeSymbol.Name}.xaml&quot;; var aXamlFileName = $&quot;{typeSymbol.Name}.axaml&quot;; var relevantXamlFile = context     .AdditionalFiles     .FirstOrDefault(text =&gt;          text.Path.EndsWith(xamlFileName) ||          text.Path.EndsWith(aXamlFileName));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c, <code>typeSymbol<\/code> \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <code>INamedTypeSymbol<\/code> \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u0445\u043e\u0434\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 <code>symbols<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435. \u0410 \u0435\u0449\u0451 \u0437\u0434\u0435\u0441\u044c \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d <strong>\u043d\u044e\u0430\u043d\u0441<\/strong>. \u0427\u0442\u043e\u0431\u044b \u0444\u0430\u0439\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043a\u0430\u043a <code>AdditionalFiles<\/code>, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b MSBuild <code>&lt;AdditionalFiles \/&gt;<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>.csproj<\/code>, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 <code>&lt;ItemGroup \/&gt;<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;ItemGroup&gt;     &lt;!-- \u041e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430, \u0431\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e          \u043a\u043e\u0434\u0430 \u043d\u0435 \u0441\u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u043f\u043e\u0442\u0440\u043e\u0448\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438! --&gt;     &lt;AdditionalFiles Include=&quot;**\\*.xaml&quot; \/&gt; &lt;\/ItemGroup&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 <code>&lt;AdditionalFiles \/&gt;<\/code> \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/new-c-source-generator-samples\/\" rel=\"nofollow\">New C# Source Generator Samples<\/a>.<\/p>\n<p>  <\/p>\n<h3 id=\"izvlekaem-polnye-imena-tipov-iz-xaml\">\u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0442\u0438\u043f\u043e\u0432 \u0438\u0437 XAML<\/h3>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u044d\u0442\u0430\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u044b\u043c \u0441\u043b\u043e\u0436\u043d\u044b\u043c, \u043d\u043e \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0437\u044f\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0438\u043c\u0451\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 XAML-\u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0435. \u0410 \u043d\u0430\u043c, \u0438\u0437-\u0437\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0439 \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u043e\u0437\u0430\u0440\u0435\u0437 \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u0443\u044e \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0451\u043d, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0438\u043f.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"http:\/\/avaloniaui.net\/\" rel=\"nofollow\">AvaloniaUI<\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">XamlX<\/a>, \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/habr.com\/ru\/users\/kekekeks\/\">@kekekeks<\/a>. \u042d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043c\u0430\u043b\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e <em>\u043d\u0435 \u0438\u043c\u0435\u0435\u0442<\/em> \u0440\u0430\u043d\u0442\u0430\u0439\u043c-\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u0443\u043c\u0435\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 XAML \u043d\u0430 <em>\u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438<\/em>, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 <em>\u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/em> \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u0432 XAML \u0438\u0437 WPF, UWP, XF \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u0442\u0430\u043a \u0435\u0449\u0451 \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 API \u0434\u043b\u044f <em>\u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 XAML<\/em> \u0438 <em>\u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432<\/em>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">XamlX<\/a> \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 (<code>git submodule add :\/\/repo .\/path<\/code>), \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 <code>MiniCompiler<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0448 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 XAML \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0442\u0438\u043f\u0430\u0445, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043a\u0430\u043a\u0438\u0445-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0431\u043e\u0440\u043a\u0430\u0445. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">XamlX.XamlCompiler<\/a> \u0432 \u0432\u0438\u0434\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0433\u043e <code>MiniCompiler<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043d\u0430\u0442\u0440\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0430 XAML-\u0444\u0430\u0439\u043b\u044b, \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">internal sealed class MiniCompiler : XamlCompiler&lt;object, IXamlEmitResult&gt; {     public static MiniCompiler CreateDefault(         RoslynTypeSystem typeSystem,         params string[] additionalTypes)     {         var mappings = new XamlLanguageTypeMappings(typeSystem);         foreach (var additionalType in additionalTypes)             mappings.XmlnsAttributes.Add(typeSystem.GetType(additionalType));         var configuration = new TransformerConfiguration(             typeSystem,             typeSystem.Assemblies[0],             mappings);         return new MiniCompiler(configuration);     }      private MiniCompiler(TransformerConfiguration configuration)         : base(configuration,                new XamlLanguageEmitMappings&lt;object, IXamlEmitResult&gt;(),                false)     {         Transformers.Add(new NameDirectiveTransformer());         Transformers.Add(new DataTemplateTransformer());         Transformers.Add(new KnownDirectivesTransformer());         Transformers.Add(new XamlIntrinsicsTransformer());         Transformers.Add(new XArgumentsTransformer());         Transformers.Add(new TypeReferenceResolver());     }      protected override XamlEmitContext&lt;object, IXamlEmitResult&gt; InitCodeGen(         IFileSource file,         Func&lt;string, IXamlType, IXamlTypeBuilder&lt;object&gt;&gt; createSubType,         object codeGen, XamlRuntimeContext&lt;object, IXamlEmitResult&gt; context,         bool needContextLocal) =&gt;         throw new NotSupportedException(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c <code>MiniCompiler<\/code> \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u044b <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">XamlX<\/a> \u0438 \u043e\u0434\u0438\u043d \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u0439 <a href=\"https:\/\/github.com\/AvaloniaUI\/Avalonia\/blob\/master\/src\/Markup\/Avalonia.Markup.Xaml.Loader\/CompilerExtensions\/Transformers\/XNameTransformer.cs\" rel=\"nofollow\"><code>NameDirectiveTransformer<\/code><\/a>, \u0442\u043e\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 <a href=\"https:\/\/habr.com\/ru\/users\/kekekeks\/\">@kekekeks<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c XAML-\u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>x:Name<\/code> \u0432 XAML-\u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>Name<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 AST \u0438 \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435. \u0422\u0430\u043a\u043e\u0439 <a href=\"https:\/\/github.com\/AvaloniaUI\/Avalonia\/blob\/master\/src\/Markup\/Avalonia.Markup.Xaml.Loader\/CompilerExtensions\/Transformers\/XNameTransformer.cs\" rel=\"nofollow\"><code>NameDirectiveTransformer<\/code><\/a> \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<p>  <\/p>\n<pre><code class=\"cs\">internal class NameDirectiveTransformer : IXamlAstTransformer {     public IXamlAstNode Transform(         AstTransformationContext context,         IXamlAstNode node)     {         \/\/ \u041d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u044b.         if (node is XamlAstObjectNode objectNode)         {             for (var index = 0; index &lt; objectNode.Children.Count; index++)             {                 \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438 x:Name, \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 Name \u0438                  \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 XamlAstObjectNode \u0434\u0430\u043b\u044c\u0448\u0435.                 var child = objectNode.Children[index];                 if (child is XamlAstXmlDirective directive &amp;&amp;                     directive.Namespace == XamlNamespaces.Xaml2006 &amp;&amp;                     directive.Name == &quot;Name&quot;)                     objectNode.Children[index] =                         new XamlAstXamlPropertyValueNode(                             directive,                             new XamlAstNamePropertyReference(                                 directive, objectNode.Type, &quot;Name&quot;, objectNode.Type),                             directive.Values);             }         }         return node;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0430\u0431\u0440\u0438\u043a\u0430 <code>MiniCompiler.CreateDefault<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0442\u0438\u043f <code>RoslynTypeSystem<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043d\u0435 \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 XamlX<\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IXamlTypeSystem<\/code>, \u0430 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0432\u0441\u0451 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0448 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432\u043d\u0443\u0442\u0440\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0442\u0438\u043f\u043e\u0432 <a href=\"https:\/\/github.com\/kekekeks\/XamlX\" rel=\"nofollow\">XamlX<\/a> \u043f\u043e\u0432\u0435\u0440\u0445 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/roslyn-sdk\/get-started\/semantic-analysis\" rel=\"nofollow\">API \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 Roslyn<\/a>. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u043e\u0439 <code>IXamlTypeSystem<\/code> \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e-\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 (<code>IXamlType<\/code> \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, <code>IXamlAssembly<\/code> \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043e\u043a, <code>IXamlMethod<\/code> \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, <code>IXamlProperty<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0438 \u0434\u0440). \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>IXamlAssembly<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public class RoslynAssembly : IXamlAssembly {     private readonly IAssemblySymbol _symbol;      public RoslynAssembly(IAssemblySymbol symbol) =&gt; _symbol = symbol;      public bool Equals(IXamlAssembly other) =&gt;         other is RoslynAssembly roslynAssembly &amp;&amp;         SymbolEqualityComparer.Default.Equals(_symbol, roslynAssembly._symbol);      public string Name =&gt; _symbol.Name;      public IReadOnlyList&lt;IXamlCustomAttribute&gt; CustomAttributes =&gt;         _symbol.GetAttributes()             .Select(data =&gt; new RoslynAttribute(data, this))             .ToList();      public IXamlType FindType(string fullName)     {         var type = _symbol.GetTypeByMetadataName(fullName);         return type is null ? null : new RoslynType(type, this);     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446 \u0441\u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442\u044c XAML \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438 XamlX, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043d\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>RoslynTypeSystem<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0435\u0439 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>CSharpCompilation<\/code>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0443\u0436\u0435 \u0438\u0437\u0432\u043b\u0435\u043a\u043b\u0438 \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435, \u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 AST \u0432 AST \u0441 \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430\u0445 \u0438\u043c\u0451\u043d \u0438 \u0442\u0438\u043f\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var parsed = XDocumentXamlParser.Parse(xaml, new Dictionary&lt;string, string&gt;()); MiniCompiler.CreateDefault(     \/\/ 'compilation' \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f 'CSharpCompilation'     new RoslynTypeSystem(compilation),     &quot;Avalonia.Metadata.XmlnsDefinitionAttribute&quot;)     .Transform(parsed);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e! \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0432\u0441\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438\u0437 \u0434\u0435\u0440\u0435\u0432\u0430 \u2014 \u0438 \u0434\u0435\u043b\u043e \u0432 \u0448\u043b\u044f\u043f\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"nahodim-imenovannye-obekty-xaml\">\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b XAML<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440 AST <a href=\"https:\/\/github.com\/kekekeks\/xamlx\" rel=\"nofollow\">XamlX<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 <code>IXamlAstTransformer<\/code>, \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u0443\u0437\u043b\u043e\u0432 \u044d\u0442\u043e\u0433\u043e AST, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IXamlAstVisitor<\/code>. \u041d\u0430\u0448 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \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\">internal sealed class NameReceiver : IXamlAstVisitor {     private readonly List&lt;(string TypeName, string Name)&gt; _items =         new List&lt;(string TypeName, string Name)&gt;();      public IReadOnlyList&lt;(string TypeName, string Name)&gt; Controls =&gt; _items;      public IXamlAstNode Visit(IXamlAstNode node)     {         if (node is XamlAstObjectNode objectNode)         {             \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0442\u0438\u043f AST-\u0443\u0437\u043b\u0430. \u0414\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0430\u043c \u0432\u044b\u0432\u0435\u043b XamlX \u0432             \/\/ \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043d\u0430\u0448\u0435\u0439 RoslynTypeSystem.             \/\/             var clrType = objectNode.Type.GetClrType();             foreach (var child in objectNode.Children)             {                 \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u0445\u043e\u0434\u0430 \u043f\u043e\u0442\u043e\u043c\u043a\u043e\u0432 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e,                 \/\/ \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f 'Name', \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u043d\u0443\u0442\u0440\u0438 'Name' \u043b\u0435\u0436\u0438\u0442 \u0441\u0442\u0440\u043e\u043a\u0430,                 \/\/ \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 '_items' \u0438\u043c\u044f \u0438 CLR-\u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 AST.                 \/\/                 if (child is XamlAstXamlPropertyValueNode propertyValueNode &amp;&amp;                     propertyValueNode.Property is XamlAstNamePropertyReference named &amp;&amp;                     named.Name == &quot;Name&quot; &amp;&amp;                     propertyValueNode.Values.Count &gt; 0 &amp;&amp;                     propertyValueNode.Values[0] is XamlAstTextNode text)                 {                     var nsType = $@&quot;{clrType.Namespace}.{clrType.Name}&quot;;                     var typeNamePair = (nsType, text.Text);                     if (!_items.Contains(typeNamePair))                         _items.Add(typeNamePair);                 }             }              return node;         }          return node;     }      public void Push(IXamlAstNode node) { }      public void Pop() { } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 XAML \u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438 \u0438\u043c\u0451\u043d XAML-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var parsed = XDocumentXamlParser.Parse(xaml, new Dictionary&lt;string, string&gt;()); MiniCompiler.CreateDefault(     \/\/ 'compilation' \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f 'CSharpCompilation'     new RoslynTypeSystem(compilation),     &quot;Avalonia.Metadata.XmlnsDefinitionAttribute&quot;)     .Transform(parsed);  var visitor = new NameReceiver(); parsed.Root.Visit(visitor); parsed.Root.VisitChildren(visitor);  \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0438 \u0442\u0438\u043f\u044b, \u0438 \u0438\u043c\u0435\u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. var controls = visitor.Controls;<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"generiruem-tipizirovannye-ssylki\">\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u2014 \u0438 \u0442\u0438\u043f\u044b, \u0438 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043c\u0451\u043d, \u0438 \u0438\u043c\u0435\u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c <code>partial<\/code>-\u043a\u043b\u0430\u0441\u0441, \u0441\u043b\u043e\u0436\u0438\u0432 \u0442\u0443\u0434\u0430 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0432\u0441\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 XAML. \u041c\u0435\u0442\u043e\u0434, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0430\u043a\u043e\u0439 <code>partial<\/code>-\u043a\u043b\u0430\u0441\u0441, \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0432\u0438\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private static string GenerateSourceCode(     List&lt;(string TypeName, string Name)&gt; controls,     INamedTypeSymbol classSymbol,     AdditionalText xamlFile) {     var className = classSymbol.Name;     var nameSpace = classSymbol.ContainingNamespace         .ToDisplayString(SymbolDisplayFormat);     var namedControls = controls         .Select(info =&gt; &quot;        &quot; +                        $&quot;internal global::{info.TypeName} {info.Name} =&gt; &quot; +                        $&quot;this.FindControl&lt;global::{info.TypeName}&gt;(\\&quot;{info.Name}\\&quot;);&quot;);     return $@&quot;\/\/ &lt;auto-generated \/&gt; using Avalonia.Controls; namespace {nameSpace} {{     partial class {className}     {{ {string.Join(&quot;\\n&quot;, namedControls)}        }} }} &quot;; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <code>GeneratorExecutionContext<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var sourceCode = GenerateSourceCode(controls, symbol, relevantXamlFile); context.AddSource($&quot;{symbol.Name}.g.cs&quot;, SourceText.From(sourceCode, Encoding.UTF8));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e!<\/p>\n<p>  <\/p>\n<h3 id=\"rezultat\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h3>\n<p>  <\/p>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 Visual Studio \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 XAML-\u0444\u0430\u0439\u043b\u0430, \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u0430\u043a <code>&lt;AdditionalFile \/&gt;<\/code>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0435\u0449\u0451 \u0440\u0430\u0437, \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 XAML-\u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0432 XAML \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0438\u0437 C#-\u0444\u0430\u0439\u043b\u0430 \u0441 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c <code>.xaml.cs<\/code>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/6759207\/98449960-6b369300-2149-11eb-9ed6-efa1cac86259.gif\" alt=\"ezgif-1-f52e7303c26f\"\/><\/p>\n<p>  <\/p>\n<p><strong>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/strong> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 <a href=\"https:\/\/github.com\/AvaloniaUI\/Avalonia.NameGenerator\" rel=\"nofollow\">GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\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 <a href=\"https:\/\/blog.jetbrains.com\/dotnet\/2020\/11\/12\/source-generators-in-net-5-with-resharper\/\" rel=\"nofollow\">JetBrains Rider \u0438 ReSharper<\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 EAP, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0439, \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Windows, Linux, \u0438 macOS. \u0412 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 Avalonia, \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u0441\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0438\u0437 \u0441\u0430\u043c\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u0438, \u0441 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0430\u043c\u0438 \u0438 <a href=\"https:\/\/github.com\/reactiveui\/reactiveui.validation\" rel=\"nofollow\">ReactiveUI.Validation<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">[GenerateTypedNameReferences] public class SignUpView : ReactiveWindow&lt;SignUpViewModel&gt; {     public SignUpView()     {         AvaloniaXamlLoader.Load(this);         this.Bind(ViewModel, x =&gt; x.Username, x =&gt; x.UserNameTextBox.Text);         this.Bind(ViewModel, x =&gt; x.Password, x =&gt; x.PasswordTextBox.Text);         this.BindValidation(ViewModel, x =&gt; x.CompoundValidation.Text);     } }<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/kekekeks\/xamlx\" rel=\"nofollow\">XamlX<\/a> \u2014 XAML-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e;<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/users\/kekekeks\/\">@kekekeks<\/a> \u2014 \u0430\u0432\u0442\u043e\u0440 <a href=\"https:\/\/github.com\/kekekeks\/xamlx\" rel=\"nofollow\">XamlX<\/a>, \u043e\u0434\u0438\u043d \u0438\u0437 lead-\u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 Avalonia \u0438 \u0438\u0434\u0435\u0439\u043d\u044b\u0439 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0442\u0435\u043b\u044c;<\/li>\n<li><a href=\"https:\/\/github.com\/avaloniaui\/avalonia.namegenerator\" rel=\"nofollow\">Avalonia.NameGenerator<\/a> \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 <code>x:Name<\/code>, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435;<\/li>\n<li><a href=\"https:\/\/github.com\/avaloniaui\/avalonia\" rel=\"nofollow\">Avalonia<\/a> \u2014 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0439 UI-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a;<\/li>\n<li><a href=\"https:\/\/github.com\/reactiveui\/reactiveui.validation\" rel=\"nofollow\">ReactiveUI.Validation<\/a> \u2014 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0438 \u0431\u0438\u043d\u0434\u0438\u043d\u0433\u0438;<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/skbkontur\/blog\/524518\/\">\u0410\u0432\u0430\u043b\u043e\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/a> \u2014 <a href=\"https:\/\/habr.com\/ru\/company\/skbkontur\/blog\/524518\/\">Larymar<\/a> \u0438 <a href=\"https:\/\/habr.com\/ru\/company\/skbkontur\/\">\u041a\u043e\u043d\u0442\u0443\u0440<\/a> \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a.<\/li>\n<\/ul>\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\/530454\/\"> https:\/\/habr.com\/ru\/post\/530454\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/user-images.githubusercontent.com\/6759207\/100546602-4b3f4e80-3273-11eb-9286-3eb7d305f382.png\"\/>  <\/p>\n<p>  \u0412 \u0430\u043f\u0440\u0435\u043b\u0435 2020-\u0433\u043e \u0433\u043e\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b .NET 5 <a href=\"https:\/\/habr.com\/ru\/post\/503172\/\">\u0431\u044b\u043b \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043d<\/a> \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f C# \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/microsoft.codeanalysis.isourcegenerator?view=roslyn-dotnet\" rel=\"nofollow\"><code>ISourceGenerator<\/code><\/a>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0438 <a href=\"https:\/\/blog.jetbrains.com\/dotnet\/2020\/11\/12\/source-generators-in-net-5-with-resharper\/\" rel=\"nofollow\">\u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b<\/a> \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, API \u043d\u043e\u0432\u044b\u0445 \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\u0445\u043e\u0436 \u0441 API <a href=\"https:\/\/habr.com\/ru\/post\/455952\/\">\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 Roslyn<\/a>. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/blog.zwezdin.com\/2013\/code-generating-with-roslyn\/\" rel=\"nofollow\">Roslyn Compiler API<\/a>, \u0442\u0430\u043a \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043a\u043e\u043d\u043a\u0430\u0442\u0435\u043d\u0430\u0446\u0438\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.<\/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-313999","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313999","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=313999"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313999\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}