{"id":168477,"date":"2013-02-06T14:34:04","date_gmt":"2013-02-06T10:34:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=168477"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=168477","title":{"rendered":"<span class=\"post_title\">\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C#. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0438\u043b\u0438 \u0442\u0435\u0445 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u0438\u0434\u0435\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0440\u0430\u0441\u0442\u0435\u0442 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0435\u043c\u0443 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u0434\u0445\u043e\u0434\u044b \u043c\u043e\u0433\u0443\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c. \u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u044d\u0442\u043e: \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432, \u0432\u044b\u043f\u0438\u0448\u0435\u043c \u0438\u0445 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u0430 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043c\u0438\u043d\u0443\u0441\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 \u043d\u0435\u043a\u0443\u044e \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<h2>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/h2>\n<p>  <\/p>\n<h4>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \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 (UI, Form, \u0444\u043e\u0440\u043c\u0430) \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0435. \u0415\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0444\u043e\u0440\u043c\u044b Form, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b (widgets, controls, \u0432\u0438\u0434\u0436\u0435\u0442\u044b). \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0444\u043e\u0440\u043c\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Form \u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0430\u044e\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u043e\u043b\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 Initialise, \u043a\u043b\u0430\u0441\u0441\u0430 Form, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u043a \u043f\u043e\u043b\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u0438\u0434\u0436\u0435\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  public class Widget { } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class WidgetNameAttribute : Attribute { \tpublic WidgetNameAttribute(string name) \t{ \t\tthis.name = name; \t}  \tpublic string Name \t{ \t\tget { return name; } \t}  \tprivate string name; } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"cs\">using System; using System.Reflection;  public class Form { \tpublic void Initialise() \t{ \t\tFieldInfo[] fields = GetType().GetFields( \t\t\tBindingFlags.FlattenHierarchy | \t\t\tBindingFlags.Instance | \t\t\tBindingFlags.Public | \t\t\tBindingFlags.NonPublic); \t\tforeach (FieldInfo field in fields) \t\t{ \t\t\tforeach (WidgetNameAttribute item in field.GetCustomAttributes( \t\t\t\ttypeof(WidgetNameAttribute), false)) \t\t\t{ \t\t\t\tWidget widget = FindWidget(item.Name); \t\t\t\tfield.SetValue(this, widget); \t\t\t\tbreak; \t\t\t} \t\t} \t}  \tpublic Widget FindWidget(string name) \t{ \t\treturn new Widget(); \t} } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"cs\">using System;  public class TestForm1 : \tForm { \t[WidgetName(&quot;Test1&quot;)] \tpublic Widget TestWidget1;  \t[WidgetName(&quot;Test2&quot;)] \tpublic Widget TestWidget2; } <\/code><\/pre>\n<p>  \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"cs\">using System;  namespace ConsoleApplication1 { \tclass Program \t{ \t\tstatic void Main(string[] args) \t\t{ \t\t\tTestForm1 form1 = new TestForm1(); \t\t\tform1.Initialise(); \t\t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 xml \u0444\u0430\u0439\u043b\u0435. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u0430\u043a \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u0415\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 Data, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u044b\u0441\u043a\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0442\u0438\u043f. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Data \u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 XPath \u043f\u0443\u0442\u044c \u0434\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f \u0432 xml. \u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 InitialiseByXml \u043a\u043b\u0430\u0441\u0441\u0430 Data \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0442\u0438\u043f. \u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0432 \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class DataValueAttribute : Attribute { \tpublic DataValueAttribute(string xPath) \t{ \t\tthis.xPath = xPath; \t}  \tpublic string XPath \t{ \t\tget { return xPath; } \t}  \tprivate string xPath; } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"cs\">using System; using System.Xml; using System.Reflection; using System.Collections.Generic;  public class DataObject { \tstatic DataObject() \t{ \t\tparsers[typeof(int)] = delegate(string value) { return int.Parse(value); }; \t\tparsers[typeof(string)] = delegate(string value) { return value; }; \t}  \tpublic void InitialiseByXml(XmlNode node) \t{ \t\tFieldInfo[] fields = GetType().GetFields( \t\t\tBindingFlags.FlattenHierarchy | \t\t\tBindingFlags.Instance | \t\t\tBindingFlags.Public | \t\t\tBindingFlags.NonPublic); \t\tforeach (FieldInfo field in fields) \t\t{ \t\t\tforeach (DataValueAttribute item in field.GetCustomAttributes( \t\t\t\ttypeof(DataValueAttribute), false)) \t\t\t{ \t\t\t\tXmlNode tergetNode = node.SelectSingleNode(item.XPath); \t\t\t\tobject value = parsers[field.FieldType](tergetNode.InnerText); \t\t\t\tfield.SetValue(this, value); \t\t\t\tbreak; \t\t\t} \t\t} \t}  \tprivate delegate object ParseHandle(string value); \tprivate static Dictionary&lt;Type, ParseHandle&gt; parsers = \t\tnew Dictionary&lt;Type, ParseHandle&gt;(); } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  public class TestDataObject1 : DataObject { \t[DataValue(&quot;Root\/IntValue&quot;)] \tpublic int Value1;  \t[DataValue(&quot;Root\/StringValue&quot;)] \tpublic string Value2; } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">using System; using System.Xml;  namespace ConsoleApplication1 { \tclass Program \t{ \t\tstatic void Main(string[] args) \t\t{ \t\t\tXmlDocument doc = new XmlDocument(); \t\t\tdoc.LoadXml( \t\t\t\t&quot;&lt;Root&gt;&quot; + \t\t\t\t&quot;&lt;IntValue&gt;42&lt;\/IntValue&gt;&quot; + \t\t\t\t&quot;&lt;StringValue&gt;Douglas Adams&lt;\/StringValue&gt;&quot; + \t\t\t\t&quot;&lt;\/Root&gt;&quot;);  \t\t\tTestDataObject1 test = new TestDataObject1(); \t\t\ttest.InitialiseByXml(doc); \t\t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 CloneableObject, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0438 \u0432\u0441\u0435\u0445 \u0441\u0432\u043e\u0438\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432. \u041a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0442\u0430\u043a \u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u043c. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 CloneableObject \u0438 \u0440\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u0442 \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0435 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044f.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class CloneAttribute : Attribute { \tpublic bool Deep \t{ \t\tget { return deep; } \t\tset { deep = value; } \t}  \tprivate bool deep; } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 CloneableObject:  <\/p>\n<pre><code class=\"cs\">using System; using System.Reflection;  public class CloneableObject : ICloneable { \tpublic object Clone() \t{ \t\tobject clone = Activator.CreateInstance(GetType());  \t\tFieldInfo[] fields = GetType().GetFields( \t\t\tBindingFlags.FlattenHierarchy | \t\t\tBindingFlags.Instance | \t\t\tBindingFlags.Public | \t\t\tBindingFlags.NonPublic); \t\tforeach (FieldInfo field in fields) \t\t{ \t\t\tforeach (CloneAttribute item in field.GetCustomAttributes( \t\t\t\ttypeof(CloneAttribute), false)) \t\t\t{ \t\t\t\tobject value = field.GetValue(this);  \t\t\t\tif (item.Deep) \t\t\t\t{ \t\t\t\t\tif (field.FieldType.IsArray) \t\t\t\t\t{ \t\t\t\t\t\tArray oldArray = (Array)value; \t\t\t\t\t\tArray newArray = (Array)oldArray.Clone(); \t\t\t\t\t\tfor (int index = 0; index &lt; oldArray.Length; index++) \t\t\t\t\t\t\tnewArray.SetValue(((ICloneable)oldArray.GetValue(index)). \t\t\t\t\t\t\t\tClone(), index); \t\t\t\t\t\tvalue = newArray; \t\t\t\t\t} \t\t\t\t\telse \t\t\t\t\t{ \t\t\t\t\t\tvalue = ((ICloneable)value).Clone(); \t\t\t\t\t} \t\t\t\t}  \t\t\t\tfield.SetValue(clone, value); \t\t\t\tbreak; \t\t\t} \t\t}  \t\treturn clone; \t} } <\/code><\/pre>\n<p>  \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  public class TestCloneableObject1 : CloneableObject { \t[Clone] \tpublic CloneableObject Value1;  \t[Clone] \tpublic CloneableObject[] ValueArray2;  \t[Clone(Deep = true)] \tpublic CloneableObject Value3;  \t[Clone(Deep = true)] \tpublic CloneableObject[] ValueArray4; } <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">using System;  namespace ConsoleApplication1 { \tclass Program \t{ \t\tstatic void Main(string[] args) \t\t{ \t\t\tTestCloneableObject1 test = new TestCloneableObject1(); \t\t\ttest.Value1 = new CloneableObject(); \t\t\ttest.ValueArray2 = new CloneableObject[] { new CloneableObject() }; \t\t\ttest.Value3 = new CloneableObject(); \t\t\ttest.ValueArray4 = new CloneableObject[] { new CloneableObject() }; \t\t\tTestCloneableObject1 test2 = (TestCloneableObject1)test.Clone(); \t\t} \t} } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u043c\u0435\u044e\u0442 \u0441\u0445\u043e\u0436\u0438\u0435 \u0447\u0435\u0440\u0442\u044b \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432.<br \/>  \u041f\u043b\u044e\u0441\u044b:  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e\u0442\u0430<\/li>\n<\/ul>\n<p>  \u041c\u0438\u043d\u0443\u0441\u044b:  <\/p>\n<ul>\n<li>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u043f\u043e\u043b\u044f<\/li>\n<li>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/li>\n<li>\u041f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u0442\u0438\u043f\u0443 \u043f\u043e\u043b\u044f, \u0445\u043e\u0442\u044f \u0435\u0433\u043e \u0442\u0438\u043f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0423\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f \u0443\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u044d\u0442\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0414\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u044b \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0435\u043c\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u0442\u044c \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b.<\/p>\n<p>  \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441:  <\/p>\n<pre><code class=\"cs\">using System;  public class TestObject1 { \t[Clone, DataValue(&quot;Root\/IntValue&quot;)] \tpublic int Value1;  \t[DataValue(&quot;Root\/StringValue&quot;)] \tpublic string Value2;  \t[Clone, WidgetName(&quot;Test1&quot;)] \tpublic Widget Widget3; } <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f 3 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430:  <\/p>\n<ul>\n<li>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 Value1 \u0438 Widget3<\/li>\n<li>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0434\u0432\u0443\u043c\u044f \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430\u043c\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 Value1 \u0438 Value2 <\/li>\n<li>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u0441 \u043e\u0434\u043d\u0438\u043c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u043d\u0430 \u043f\u043e\u043b\u0435 Widget3<\/li>\n<\/ul>\n<p>  \u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/9f7\/870\/dcb\/9f7870dcbe089de5254ab4f462db2994.png\"\/><\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0422\u0435\u043a\u0443\u0449\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439, \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432, \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043d\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h4>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/h4>\n<p>  \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432. \u0412\u0441\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 FieldSetterAttribute \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043c\u0435\u0442\u043e\u0434 Generate, \u0433\u0434\u0435 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Reflection;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] public abstract class FieldSetterAttribute : Attribute { \tpublic abstract void Generate(Initialiser initialiser, FieldInfo info); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/h4>\n<p>  \u0417\u0430\u0434\u0430\u0447\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0441\u0435\u0431\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044e.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic;  public delegate void InitialiseHandle(object target, object data);  public class Initialiser { \tpublic void Add(InitialiseHandle handle) \t{ \t\thandlers.Add(handle); \t}  \tpublic void Initialise(object target, object data) \t{ \t\tforeach (InitialiseHandle handler in handlers) \t\t\thandler(target, data); \t}  \tprivate List&lt;InitialiseHandle&gt; handlers = new List&lt;InitialiseHandle&gt;(); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/h4>\n<p>  \u041a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0414\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0442\u0438\u043f\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic;  public class Container { \tpublic Initialiser GetInitialiser(Type type) \t{ \t\tInitialiser result; \t\tif (!initialisers.TryGetValue(type, out result)) \t\t{ \t\t\tresult = new Initialiser(); \t\t\tinitialisers.Add(type, result); \t\t} \t\treturn result; \t}  \tprivate Dictionary&lt;Type, Initialiser&gt; initialisers = new Dictionary&lt;Type, Initialiser&gt;(); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0442\u0438\u043f\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System; using System.Collections.Generic; using System.Reflection;  public static class TypeManager { \tpublic static Container GetContainer(Type type) \t{ \t\tContainer result; \t\tif (!containers.TryGetValue(type, out result)) \t\t{ \t\t\tresult = new Container(); \t\t\tcontainers.Add(type, result); \t\t\tInitialiseContainer(type, result); \t\t} \t\treturn result; \t}  \tprivate static void InitialiseContainer(Type type, Container container) \t{ \t\tFieldInfo[] fields = type.GetFields( \t\t\tBindingFlags.FlattenHierarchy | \t\t\tBindingFlags.Instance | \t\t\tBindingFlags.Public | \t\t\tBindingFlags.NonPublic); \t\tforeach (FieldInfo field in fields) \t\t{ \t\t\tforeach (FieldSetterAttribute item in field.GetCustomAttributes( \t\t\t\ttypeof(FieldSetterAttribute), false)) \t\t\t{ \t\t\t\tInitialiser initialiser = container.GetInitialiser(item.GetType()); \t\t\t\titem.Generate(initialiser, field); \t\t\t} \t\t} \t}  \tprivate static Dictionary&lt;Type, Container&gt; containers = new Dictionary&lt;Type, Container&gt;(); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h4>\u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<p>  \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0439 \u0430\u0442\u0440\u0438\u0431\u0443\u0442, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044f \u0435\u0433\u043e \u043e\u0442 FieldSetterAttribute \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 Generate. \u0412 \u043c\u0435\u0442\u043e\u0434 Generate \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 Initialiser \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u043a \u0442\u0438\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043b\u0435 FieldInfo. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0434\u0435\u043b\u0435\u0433\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u043e\u043b\u0435\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440.<br \/>  \u041f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0435\u0433\u043e \u043f\u043e\u0438\u0441\u043a \u0438 \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d, \u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u0432\u0441\u0435\u0445 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u0438 \u0435\u0441\u043b\u0438 \u0443 \u043d\u0438\u0445 \u0435\u0441\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u043e\u0442 FieldSetterAttribute \u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 Generate. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435, \u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0435.<br \/>  \u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e \u0442\u0438\u043f\u0443 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 Initialise, \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0442\u0443\u0434\u0430 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u044b \u0432\u0441\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432<\/h4>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 TestObject1. \u041d\u043e\u0432\u044b\u0439 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043d\u0430\u0437\u043e\u0432\u0435\u043c TestObject2.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430:  <\/p>\n<pre><code class=\"cs\">using System;  public class TestObject2 : Form, ICloneable { \t[Clone, DataValue(&quot;Root\/IntValue&quot;)] \tpublic int Value1;  \t[DataValue(&quot;Root\/StringValue&quot;)] \tpublic string Value2;  \t[Clone(Deep = true), WidgetName(&quot;Test1&quot;)] \tpublic Widget Widget3;  \tpublic object Clone() \t{ \t\tobject clone = Activator.CreateInstance(GetType()); \t\tTypeManager.GetContainer(GetType()). \t\t\tGetInitialiser(typeof(CloneAttribute)).Initialise(clone, this); \t\treturn clone; \t} } <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">using System;  public class Widget : ICloneable { \tpublic object Clone() \t{ \t\treturn new Widget(); \t} } <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u043e\u0440\u043c\u044b:  <\/p>\n<pre><code class=\"cs\">using System;  public class Form { \tpublic void Initialise() \t{ \t\tTypeManager.GetContainer(GetType()). \t\t\tGetInitialiser(typeof(WidgetNameAttribute)).Initialise(this, null); \t}  \tpublic Widget FindWidget(string name) \t{ \t\treturn new Widget(); \t} } <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438:  <\/p>\n<pre><code class=\"cs\">using System; using System.Reflection;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class WidgetNameAttribute : FieldSetterAttribute { \tpublic WidgetNameAttribute(string name) \t{ \t\tthis.name = name; \t}  \tpublic override void Generate(Initialiser initialiser, FieldInfo info) \t{ \t\tinitialiser.Add( \t\t\tdelegate(object target, object data) \t\t\t{ \t\t\t\tForm targetForm = (Form)target; \t\t\t\tWidget widget = targetForm.FindWidget(name); \t\t\t\tinfo.SetValue(targetForm, widget); \t\t\t} \t\t); \t}  \tprivate string name; } <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code class=\"cs\">using System; using System.Reflection; using System.Xml; using System.Collections.Generic;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class DataValueAttribute : FieldSetterAttribute { \tstatic DataValueAttribute() \t{ \t\tparsers[typeof(int)] = delegate(string value) { return int.Parse(value); }; \t\tparsers[typeof(string)] = delegate(string value) { return value; }; \t}  \tpublic DataValueAttribute(string xPath) \t{ \t\tthis.xPath = xPath; \t}  \tpublic override void Generate(Initialiser initialiser, FieldInfo info) \t{ \t\tParseHandle parser = parsers[info.FieldType]; \t\tinitialiser.Add( \t\t\tdelegate(object target, object data) \t\t\t{ \t\t\t\tXmlNode node = ((XmlNode)data).SelectSingleNode(xPath); \t\t\t\tobject value = parser(node.InnerText); \t\t\t\tinfo.SetValue(target, value); \t\t\t} \t\t); \t}  \tprivate string xPath;  \tprivate delegate object ParseHandle(string value); \tprivate static Dictionary&lt;Type, ParseHandle&gt; parsers = \t\tnew Dictionary&lt;Type, ParseHandle&gt;(); } <\/code><\/pre>\n<p>  \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0434\u043b\u044f \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"cs\">using System; using System.Reflection;  [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class CloneAttribute : FieldSetterAttribute { \tpublic override void Generate(Initialiser initialiser, FieldInfo info) \t{ \t\tif (deep) \t\t{ \t\t\tif (info.FieldType.IsArray) \t\t\t{ \t\t\t\tinitialiser.Add( \t\t\t\t\tdelegate(object target, object data) \t\t\t\t\t{ \t\t\t\t\t\tobject value = info.GetValue(data); \t\t\t\t\t\tArray oldArray = (Array)value; \t\t\t\t\t\tArray newArray = (Array)oldArray.Clone(); \t\t\t\t\t\tfor (int index = 0; index &lt; oldArray.Length; index++) \t\t\t\t\t\t\tnewArray.SetValue(((ICloneable)oldArray.GetValue(index)). \t\t\t\t\t\t\t\tClone(), index); \t\t\t\t\t\tvalue = newArray; \t\t\t\t\t\tinfo.SetValue(target, value); \t\t\t\t\t} \t\t\t\t); \t\t\t} \t\t\telse \t\t\t{ \t\t\t\tinitialiser.Add( \t\t\t\t\tdelegate(object target, object data) \t\t\t\t\t{ \t\t\t\t\t\tobject value = info.GetValue(data); \t\t\t\t\t\tvalue = ((ICloneable)value).Clone(); \t\t\t\t\t\tinfo.SetValue(target, value); \t\t\t\t\t} \t\t\t\t); \t\t\t} \t\t} \t\telse \t\t{ \t\t\tinitialiser.Add( \t\t\t\tdelegate(object target, object data) \t\t\t\t{ \t\t\t\t\tobject value = info.GetValue(data); \t\t\t\t\tinfo.SetValue(target, value); \t\t\t\t} \t\t\t); \t\t} \t}  \tpublic bool Deep \t{ \t\tget { return deep; } \t\tset { deep = value; } \t}  \tprivate bool deep; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0418\u0442\u043e\u0433<\/h2>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0430\u043a \u0438 \u0441\u043d\u0430\u0440\u0443\u0436\u0438. \u0421\u043b\u043e\u0436\u043d\u044b\u0435 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u044b\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u043e\u043b\u044f \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0434\u0435\u043b\u0435\u0433\u0430\u0442. \u0417\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u043b\u0435\u0439 \u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u0412\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0434\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e.<br \/>  \u0421\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/168477\/\"> http:\/\/habrahabr.ru\/post\/168477\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 C#. \u0421\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0438\u043b\u0438 \u0442\u0435\u0445 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c. \u0412\u0441\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043e\u0442\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438\u043b\u0438 \u0438\u0434\u0435\u0439.  <\/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-168477","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168477","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=168477"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/168477\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}