{"id":459238,"date":"2025-05-12T03:15:44","date_gmt":"2025-05-12T03:15:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=459238"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=459238","title":{"rendered":"<span>\u0422\u0430\u043a\u043e\u0433\u043e \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f\u00bb \u0432\u044b \u0435\u0449\u0451 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u2014 Visitor.NET<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/896752\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg 781w\" loading=\"lazy\" decode=\"async\"\/><\/a><\/p>\n<p> \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c\u00bb (visitor) \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0411\u0430\u043d\u0434\u044b \u0427\u0435\u0442\u044b\u0440\u0451\u0445.<\/p>\n<p> \u041d\u0430 \u044f\u0437\u044b\u043a\u0435 C# \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p> \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u0435\u0441\u044c \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430, \u043b\u0438\u0448\u0451\u043d\u043d\u0443\u044e \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u0438 \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430!<a name=\"habracut\"><\/a><\/p>\n<p> \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u044b \u0447\u0438\u0442\u0430\u0435\u0448\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0442\u044b \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438, \u043a\u0430\u043a \u041e\u041e\u041f, \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u0440\u0430\u0437 \u0432 \u0436\u0438\u0437\u043d\u0438 \u0441\u043b\u044b\u0448\u0430\u043b \u0441\u043b\u043e\u0432\u043e Visitor.<\/p>\n<p> \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c\u00bb, \u0434\u0430 \u0447\u0442\u043e \u0442\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c? \u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0442\u0435\u0431\u0435, \u043a\u0430\u043a \u0438\u0437\u043e\u0431\u0440\u0451\u043b \u0435\u0433\u043e \u043d\u043e\u0432\u0443\u044e \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<h2><font color=\"#3AC1EF\">\u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043e Visitor<\/font><\/h2>\n<p> \u0413\u0434\u0435 \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0451\u0442\u0435\u0441\u044c \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d?<\/p>\n<ul>\n<li>\u0421\u0430\u043c\u043e\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u2014 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c Abstract Syntax Tree.<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 Expressions API \u0438\u043b\u0438 Roslyn API \u2014 \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u043f\u0440\u044f\u043c\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430.<\/li>\n<li>\u041f\u0430\u0442\u0442\u0435\u0440\u043d \u00ab\u041a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u0449\u0438\u043a\u00bb, \u043e\u043d \u0436\u0435 Composite \u2014 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0430\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<\/ul>\n<p> \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u043c \u0432\u044b\u0434\u0435\u043b\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 DSL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0434\u043e\u043a\u043b\u0430\u0434 \u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0438 DSL \u0432 \u043a\u0440\u043e\u0432\u0430\u0432\u043e\u043c \u044d\u043d\u0442\u0435\u0440\u043f\u0440\u0430\u0439\u0437\u0435:<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/67ed3f25fec567ba65b96f39\" data-style=\"\" id=\"67ed3f25fec567ba65b96f39\" width=\"\"><\/div>\n<\/div>\n<p>\u042f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043d\u0438\u043c\u0438 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0432 \u0412\u0423\u0417\u0435. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u043e\u044f \u043a\u0430\u0444\u0435\u0434\u0440\u0430, \u0418\u0423-9 \u041c\u0413\u0422\u0423 \u0438\u043c. \u041d. \u042d. \u0411\u0430\u0443\u043c\u0430\u043d\u0430, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u0432, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u043e \u0442\u0435\u043c\u0443 \u0434\u0438\u043f\u043b\u043e\u043c\u0430 \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p> \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044f \u0431\u0440\u0430\u043b \u043d\u0435\u043a\u0438\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u0430\u0440\u0441\u0438\u043b \u0435\u0433\u043e \u0432 AST, \u0430 \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0445\u043e\u0434\u0438\u043b \u0434\u0435\u0440\u0435\u0432\u043e \u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3w\/ys\/xk\/3wysxkttabuuxgulnj7yx6aturg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/3w\/ys\/xk\/3wysxkttabuuxgulnj7yx6aturg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/3w\/ys\/xk\/3wysxkttabuuxgulnj7yx6aturg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412\u043e\u043e\u0431\u0449\u0435, AST \u0432 \u044d\u0442\u043e\u0439 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u2014 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u0438\u0440\u043f\u0438\u0447, \u043a\u0430\u043a JSON \u0432 \u043f\u0440\u043e\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u2014 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0435\u0433\u043e \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<ul>\n<li>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/li>\n<li>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437<\/li>\n<li>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/li>\n<li>\u041a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f<\/li>\n<li>\u0418 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435<\/li>\n<\/ul>\n<p> \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u043e\u0441\u0442\u0440\u043e!<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0418\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434<\/font><\/h3>\n<p> \u042d\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f. \u0422\u0430\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code class=\"cs\">public abstract class AbstractSyntaxTreeNode {     public virtual List&lt;Instruction&gt; ToInstructions(int start) =&gt; new(); } <\/code><\/pre>\n<p> \u041f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435\u0434\u0430\u043b\u044c\u043d\u043e\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0443\u0434\u043d\u043e\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0438 \u043d\u0435\u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0431\u0430\u0433\u0438. \u0422\u0430\u043a\u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447 \u0440\u0430\u0441\u0442\u0451\u0442 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0438\u0437-\u0437\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p> \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043b\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 \u043b\u0438\u0431\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u043b\u0430 \u0432 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0446\u0438\u043a\u043b, \u043b\u0438\u0431\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0441\u044f runtime exception:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/o3\/0u\/8-\/o30u8-o2kuefskomki_6bichvs8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/o3\/0u\/8-\/o30u8-o2kuefskomki_6bichvs8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/o3\/0u\/8-\/o30u8-o2kuefskomki_6bichvs8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0451 \u043f\u043b\u043e\u0445\u043e, \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u0434, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043e \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f\u00bb:<\/p>\n<pre><code class=\"cs\">public override List&lt;Instruction&gt; ToInstructions(int start, string temp) {     var instructions = new List&lt;Instruction&gt;();      (IValue left, IValue right) right = (null, null);     if (_expression.Primary())     {         right.right = ((PrimaryExpression) _expression).ToValue();     }     else     {         instructions.AddRange(_expression.ToInstructions(start, temp));         if (_expression is MemberExpression member &amp;&amp; member.Any())         {             var i = start + instructions.Count;             var dest = \"_t\" + i;             var src = instructions.Any()                 ? instructions.OfType&lt;Simple&gt;().Last().Left                 : member.Id;             var instruction = member.AccessChain.Tail switch             {                 DotAccess dot =&gt; new Simple(dest, (new Name(src), new Constant(dot.Id, dot.Id)), \".\", i),                 IndexAccess index =&gt; new Simple(dest, (new Name(src), index.Expression.ToValue()), \"[]\", i),                 _ =&gt; throw new NotImplementedException()             };             instructions.Add(instruction);         }         right.right = new Name(instructions.OfType&lt;Simple&gt;().Last().Left);     }      var number = instructions.Any() ? instructions.Last().Number + 1 : start;      instructions.Add(new Simple(         temp + number, right, _operator, number     ));     return instructions; } <\/code><\/pre>\n<p> \u0410 \u043a\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430, \u0432\u0438\u0434\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0435 \u2014 \u043a\u043e\u0434 \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e \u0442\u0435\u043a\u0441\u0442\u0443 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435:<\/p>\n<pre><code class=\"cs\">public AddressedInstructions Visit(UnaryExpression visitable) {     if (visitable.Expression is PrimaryExpression primary)         return [new Simple(visitable.Operator, _valueDtoConverter.Convert(primary.ToValueDto()))];          var result = visitable.Expression.Accept(This);     var last = new Name(result.OfType&lt;Simple&gt;().Last().Left!);     result.Add(new Simple(visitable.Operator, last));          return result; } <\/code><\/pre>\n<p> \u0412 \u0447\u0451\u043c \u0436\u0435 \u043c\u0430\u0433\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0438\u0441\u0442\u043e\u043a\u0430\u043c \u0438 \u043e\u0441\u0432\u0435\u0436\u0438\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Visitor<\/font><\/h3>\n<p> \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0440\u0443\u0433 \u043d\u0430\u043f\u0440\u043e\u0442\u0438\u0432 \u0434\u0440\u0443\u0433\u0430 \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0438\u0445 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0438. \u0415\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0438 \u0435\u0451 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0447\u043b\u0435\u043d\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yw\/ey\/mx\/yweymxhbabfv79x9oeetij4ug8u.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yw\/ey\/mx\/yweymxhbabfv79x9oeetij4ug8u.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yw\/ey\/mx\/yweymxhbabfv79x9oeetij4ug8u.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ul>\n<li>\u0420\u0435\u0448\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u043d\u0442\u0440\u0443\u0437\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0430 \u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043a\u043b\u0430\u0441\u0441 \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f\u00bb.<\/li>\n<li>\u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u0441\u0445\u0435\u043c\u0435 double dispatch \u2014 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432 + \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 (ad-hoc \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c). \u0422\u043e \u0435\u0441\u0442\u044c \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u043e\u0435 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430.<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412\u043c\u0435\u0441\u0442\u043e <code>void<\/code> \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>string<\/code>.<\/li>\n<\/ul>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e Visitor<\/font><\/h3>\n<p> \u041d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043c\u0438\u0433\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u2014 \u043a\u043b\u0430\u0441\u0441 <code>Visitor<\/code> \u0437\u043d\u0430\u0435\u0442 \u0432\u0441\u0451 \u043f\u0440\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432 <code>Element<\/code>.<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ff\/xc\/4v\/ffxc4vvv9ml3bc14iep0kehzv_a.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ff\/xc\/4v\/ffxc4vvv9ml3bc14iep0kehzv_a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ff\/xc\/4v\/ffxc4vvv9ml3bc14iep0kehzv_a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c \u043e\u0431\u0435\u0438\u0445 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043b\u044e\u0431\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u043f\u043e\u0432\u043b\u0435\u0447\u0451\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439. \u041f\u043e\u0447\u0435\u043c\u0443 \u044f \u0433\u043e\u0432\u043e\u0440\u044e \u043f\u0440\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439, \u0435\u0441\u043b\u0438 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 <code>Visitor<\/code>?<\/p>\n<pre><code class=\"cs\">abstract class Element {     abstract void Accept(IVisitor visitor); }  interface IVisitor {     void Visit(ElementA elementA);      void Visit(ElementB elementB); }  class VisitorOne : IVisitor {     public void Visit(ElementA elementA) {}      public void Visit(ElementB elementB) {} }  class VisitorTwo : IVisitor {     public void Visit(ElementA elementA) {}      public void Visit(ElementB elementB) {} } <\/code><\/pre>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0410\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 Visitor<\/font><\/h3>\n<p> \u0423\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0439 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c\u044e. \u0412\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0434\u0432\u0435 \u043d\u043e\u0432\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u0443\u044e \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u043e\u0442\u0434\u0435\u043b\u044f\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041e\u0434\u043d\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u00ab\u0441\u0431\u043e\u0440\u043a\u0438\u00bb \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f. \u0422\u0430\u043a\u043e\u0439 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0438\u043f\u043e\u0432 \u043e\u043f\u0438\u0441\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u043c\u0435\u0435\u0442 \u043f\u043e\u0441\u0435\u0449\u0430\u0442\u044c \u0442\u043e\u0442 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 LEGO.<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/pf\/gs\/yc\/pfgsycz_kpa1rnurf3kboefr8bg.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/pf\/gs\/yc\/pfgsycz_kpa1rnurf3kboefr8bg.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/pf\/gs\/yc\/pfgsycz_kpa1rnurf3kboefr8bg.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u2014 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0442\u043e, \u043a\u0430\u043a \u0435\u0451 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c, \u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<pre><code class=\"cs\">public class ElementA : Element {     public override void Accept(IVisitor visitor)     {         if (visitor is IVisitor&lt;ElementA&gt; typed)             typed.Visit(this);     } } <\/code><\/pre>\n<p> \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0440\u0435\u0447\u044c \u043f\u0440\u043e \u043f\u043e\u0442\u0435\u0440\u044e \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 compile-time \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432 \u0432 runtime.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 downcasting<\/font><\/h3>\n<p> \u0418\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430 \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432, \u043c\u044b \u0442\u0435\u0440\u044f\u0435\u043c \u0435\u0433\u043e \u0441\u0443\u0442\u044c \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0442\u0438\u043f\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u044f\u0432\u043d\u044b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 (\u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0432\u043e\u0439). \u041d\u0443 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0430\u0437\u0435\u0439\u043a\u043e\u0439 \u0434\u043b\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0443\u043b\u043e\u0432\u0438\u043c\u044b\u0445 \u0431\u0430\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p> \u041f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u0445 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c downcasting?<\/p>\n<ul>\n<li>\u0415\u0441\u0442\u044c 100% \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u043d\u0438\u0435 \u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0442\u0438\u043f\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0435\u0451 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f <b><font color=\"#3AC1EF\">(\u043d\u0435\u0442)<\/font><\/b>.<\/li>\n<li>\u0417\u043d\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0437\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 <b><font color=\"#3AC1EF\">(\u043e\u0442\u0447\u0430\u0441\u0442\u0438)<\/font><\/b>.<\/li>\n<li>\u041f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043e\u0442\u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0442\u044c \u043a\u043e\u0434 \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f <b><font color=\"#3AC1EF\">(\u043d\u0435\u0442)<\/font><\/b>.<\/li>\n<\/ul>\n<p> \u0422\u0430\u043a\u0436\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043c\u0435\u0442\u043e\u0434 <code>Accept<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u0441\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043e\u0434\u043d\u0430\u043a\u043e \u0432 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/8r\/hv\/xc\/8rhvxcip5yr9k9pyylvkgivsoc8.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/8r\/hv\/xc\/8rhvxcip5yr9k9pyylvkgivsoc8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/8r\/hv\/xc\/8rhvxcip5yr9k9pyylvkgivsoc8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0442\u0438\u043f\u0443 <code>IVisitor<\/code>, \u0430 \u0441\u0430\u043c <code>IVisitor<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0447\u043b\u0435\u043d\u043e\u0432:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/gj\/cj\/zo\/gjcjzoum3wm_hxagmxt-wzgazqe.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/gj\/cj\/zo\/gjcjzoum3wm_hxagmxt-wzgazqe.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/gj\/cj\/zo\/gjcjzoum3wm_hxagmxt-wzgazqe.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u042f\u0437\u044b\u043a \u041e\u041e, \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u041e\u041e, \u0430 \u043a\u043e\u0434 \u043d\u0435 \u041e\u041e<\/font><\/h2>\n<p> <i>(\u041e\u041e \u2014 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439)<\/i><\/p>\n<p> \u041f\u043e\u0447\u0435\u043c\u0443 \u0432\u0441\u0451 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0439\u0442\u0438 \u0437\u0430 \u0440\u0430\u043c\u043a\u0438 \u0443\u0447\u0435\u0431\u043d\u0438\u043a\u043e\u0432 \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u043e\u0434\u0445\u043e\u0434? \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443 \u044d\u0442\u043e \u043f\u043e\u0447\u0438\u043d\u0438\u0442\u044c. \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 (\u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c, \u0438\u0437\u0431\u0438\u0440\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435 OCP \u0438 LSP \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435).<\/li>\n<li>\u041e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438).<\/li>\n<\/ul>\n<p> \u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e, \u0432 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 C#.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041a\u043e\u043d\u0442\u0440\u0430\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c<\/font><\/h3>\n<p> \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u043e\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cs\">interface IFooIn&lt;in TInputType&gt; {     void Bar(TInputType input); } <\/code><\/pre>\n<p> \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 <code>IComparable<\/code>, \u0433\u0434\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">IComparable&lt;IEnumerable&lt;char&gt;&gt; charEnumerableComparable = \/\/ ...;  \/\/ ...  IComparable&lt;string&gt; stringComparable = charEnumerableComparable; <\/code><\/pre>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041a\u043e\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c<\/font><\/h3>\n<p> \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u043e\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<pre><code class=\"cs\">interface IFooOut&lt;out TOutputType&gt; {     TOutputType Baz(); } <\/code><\/pre>\n<p> \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 <code>IEnumerable<\/code>, \u0433\u0434\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">IEnumerable&lt;Task&lt;object&gt;&gt; tasksWithResults = \/\/ ...;  \/\/ ...  IEnumerable&lt;Task&gt; tasks = tasksWithResults; <\/code><\/pre>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0427\u0435\u043c \u044d\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e?<\/font><\/h3>\n<p> \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u0435\u0440\u0432\u0443\u044e \u0438 \u0432\u0442\u043e\u0440\u0443\u044e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0449\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"cs\">interface IFooInOut&lt;in TInputType, out TOutputType&gt; {     TOutputType Foo(TInputType input); } <\/code><\/pre>\n<p> \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u044d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 IL \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f.<\/p>\n<p> \u0412\u043e\u043e\u0431\u0449\u0435, \u043a\u0430\u043a\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c?<\/p>\n<ul>\n<li>\u041f\u0440\u044f\u043c\u043e\u0435 (Direct) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0442\u0438\u043f.<\/li>\n<li>\u041d\u0435\u044f\u0432\u043d\u043e\u0435 (Implicit) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u0442\u0438\u043f \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u0442\u0438\u043f\u0443 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/li>\n<li>\u042f\u0432\u043d\u043e\u0435 (Explicit) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f <code>(Type)<\/code>. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 IL \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>castclass<\/code>.<\/li>\n<li>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 (As) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>as<\/code>, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043d\u0435\u0443\u0434\u0430\u0447\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c <code>null<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 IL \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f <code>isinst<\/code>.<\/li>\n<li>\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 (Dynamic) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>dynamic<\/code>. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0443\u0440\u043e\u0432\u0435\u043d\u044c IL.<\/li>\n<\/ul>\n<p> \u041c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a\u043e\u0432\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432? \u042f \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0435\u0451 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c:<\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041a\u043e\u0434 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cs\">using System.Diagnostics.CodeAnalysis; using BenchmarkDotNet.Attributes; using BenchmarkDotNet.Running;  BenchmarkRunner.Run&lt;CastingBenchmarks&gt;();  [SuppressMessage(\"ReSharper\", \"ReturnValueOfPureMethodIsNotUsed\")] [SuppressMessage(\"Performance\", \"CA1822:\u041f\u043e\u043c\u0435\u0442\u044c\u0442\u0435 \u0447\u043b\u0435\u043d\u044b \u043a\u0430\u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435\")] #pragma warning disable CA1050 public class CastingBenchmarks #pragma warning restore CA1050 {     private static readonly ICovariant&lt;Task&lt;object&gt;&gt; SpecificCovariant = new Covariant&lt;Task&lt;object&gt;&gt;();     private static readonly ICovariant&lt;Task&gt; GeneralCovariant = SpecificCovariant;      private static readonly IContravariant&lt;IEnumerable&lt;char&gt;&gt; GeneralContravariant = new Contravariant&lt;IEnumerable&lt;char&gt;&gt;();     private static readonly IContravariant&lt;string&gt; SpecificContravariant = GeneralContravariant;      [Benchmark(Baseline = true)]     public void Direct()     {         SpecificCovariantMethod(SpecificCovariant);         GeneralContravariantMethod(GeneralContravariant);     }      [Benchmark]     public void Implicit()     {         GeneralCovariantMethod(SpecificCovariant);         SpecificContravariantMethod(GeneralContravariant);     }      [Benchmark]     public void Explicit()     {         SpecificCovariantMethod((ICovariant&lt;Task&lt;object&gt;&gt;)GeneralCovariant);         GeneralContravariantMethod((IContravariant&lt;IEnumerable&lt;char&gt;&gt;)SpecificContravariant);     }      [Benchmark]     public void As()     {         SpecificCovariantMethod((GeneralCovariant as ICovariant&lt;Task&lt;object&gt;&gt;)!);         GeneralContravariantMethod((SpecificContravariant as IContravariant&lt;IEnumerable&lt;char&gt;&gt;)!);     }      [Benchmark]     public void Dynamic()     {         SpecificCovariantMethod((dynamic)GeneralCovariant);         GeneralContravariantMethod((dynamic)SpecificContravariant);     }      \/\/ ReSharper disable once UnusedTypeParameter     private interface ICovariant&lt;out T&gt;;      private class Covariant&lt;T&gt; : ICovariant&lt;T&gt;;      private static void SpecificCovariantMethod(ICovariant&lt;Task&lt;object&gt;&gt; input) =&gt;         input.ToString();      private static void GeneralCovariantMethod(ICovariant&lt;Task&gt; input) =&gt;         input.ToString();      \/\/ ReSharper disable once UnusedTypeParameter     private interface IContravariant&lt;in T&gt;;      private class Contravariant&lt;T&gt; : IContravariant&lt;T&gt;;      private static void SpecificContravariantMethod(IContravariant&lt;string&gt; input) =&gt;         input.ToString();      private static void GeneralContravariantMethod(IContravariant&lt;IEnumerable&lt;char&gt;&gt; input) =&gt;         input.ToString(); } <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> \u041c\u043e\u044f \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 \u0431\u044b\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439: Dynamic \u0441\u0430\u043c\u044b\u0439 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439, Implicit \u0438 Direct \u0447\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 Explicit \u0438 As. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0451 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b:<\/p>\n<pre><code class=\"plaintext\">BenchmarkDotNet v0.13.11, macOS Ventura 13.7.2 (22H313) [Darwin 22.6.0] Apple M1 Pro, 1 CPU, 10 logical and 10 physical cores .NET SDK 9.0.200   [Host]   : .NET 9.0.2 (9.0.225.6610), Arm64 RyuJIT AdvSIMD   ShortRun : .NET 9.0.2 (9.0.225.6610), Arm64 RyuJIT AdvSIMD  Job=ShortRun  IterationCount=3  LaunchCount=1   WarmupCount=3 <\/code><\/pre>\n<p> <\/p>\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<td><b><font color=\"#3AC1EF\">Method<\/font><\/b><\/td>\n<td><b><font color=\"#3AC1EF\">Mean<\/font><\/b><\/td>\n<td><b><font color=\"#3AC1EF\">Ratio<\/font><\/b><\/td>\n<\/tr>\n<tr>\n<td>Direct<\/td>\n<td>5.226 ns<\/td>\n<td>1.00<\/td>\n<\/tr>\n<tr>\n<td>Implicit<\/td>\n<td>5.234 ns<\/td>\n<td>1.00<\/td>\n<\/tr>\n<tr>\n<td>Explicit<\/td>\n<td>5.266 ns<\/td>\n<td>1.01<\/td>\n<\/tr>\n<tr>\n<td>As<\/td>\n<td>5.261 ns<\/td>\n<td>1.01<\/td>\n<\/tr>\n<tr>\n<td>Dynamic<\/td>\n<td>14.278 ns<\/td>\n<td>2.73<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<h2><font color=\"#3AC1EF\">\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 Visitor.NET<\/font><\/h2>\n<p> \u0421\u043e\u0432\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043a\u0440\u044b\u043b\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439. \u042f \u043f\u043e\u0448\u0451\u043b \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0434\u0435\u0438 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0438 \u0432\u0432\u0451\u043b \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u0441\u0435\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u2014 <code>IVisitable<\/code>. \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u0432\u044b\u0448\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438:<\/p>\n<pre><code class=\"cs\">public interface IVisitable&lt;out TVisitable&gt;     where TVisitable : IVisitable&lt;TVisitable&gt; {     TReturn Accept&lt;TReturn&gt;(IVisitor&lt;TVisitable, TReturn&gt; visitor); }  public interface IVisitor&lt;in TVisitable, out TReturn&gt;     where TVisitable : IVisitable&lt;TVisitable&gt; {     TReturn Visit(TVisitable visitable); } <\/code><\/pre>\n<p> \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0442\u0435\u043f\u0435\u0440\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u2014 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e downcasting.<\/p>\n<p> \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f \u043e\u0431 \u043e\u0431\u043e\u0438\u0445 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f\u0445.<\/p>\n<p> \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0445\u0435\u043c\u0430 triple dispatch:<\/p>\n<ol>\n<li>\u0412 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a <code>Accept<\/code>.<\/li>\n<li>\u0412 Accept \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u00ab\u0431\u0430\u0437\u043e\u0432\u044b\u0439\u00bb \u0432\u0438\u0437\u0438\u0442\u043e\u0440 \u0434\u043b\u044f \u043a\u043e\u0440\u043d\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u043d\u0442\u0440\u0430\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u043e\u043d \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 <code>Accept<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430, \u0433\u0434\u0435 \u043e\u043d \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430.<\/li>\n<li>\u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 <code>Accept<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430 <code>Visit<\/code> \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0438\u043f\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/li>\n<\/ol>\n<p> <\/p>\n<pre><code class=\"cs\">public abstract class Element : IVisitable&lt;Element&gt; {     public abstract TReturn Accept&lt;TReturn&gt;(         IVisitor&lt;Element, TReturn&gt; visitor); }  public class ElementA : Element, IVisitable&lt;ElementA&gt; {     public override TReturn Accept&lt;TReturn&gt;(         IVisitor&lt;Element, TReturn&gt; visitor) =&gt;         Accept(visitor);      public TReturn Accept&lt;TReturn&gt;(         IVisitor&lt;ElementA, TReturn&gt; visitor) =&gt;         visitor.Visit(this); } <\/code><\/pre>\n<p> \u041c\u043d\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044f, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0441\u0443\u0442\u044c \u2014 \u0432\u0441\u0451 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u0445 \u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u0445. \u0412\u0441\u0451 \u0436\u0435, \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0432\u0438\u0437\u0438\u0442\u043e\u0440\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c, \u0432\u0441\u0451 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439.<\/p>\n<pre><code class=\"cs\">public class ElementVisitor : VisitorNoReturnBase&lt;Element&gt;,     IVisitor&lt;ElementA&gt; {     public VisitUnit Visit(ElementA visitable)     {         return default;     } } <\/code><\/pre>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d Visitor.NET + SourceGenerators!<\/font><\/h3>\n<p> \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Accept<\/code> \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0440\u0443\u0434\u043d\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 \u0438\u0437-\u0437\u0430 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0443\u0436\u0435 \u0440\u0435\u0448\u0451\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Source Generators!<\/p>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u0432 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0432\u0435\u0441\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <code>[AutoVisitable]<\/code> \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0440\u043d\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438 \u0432 \u0443\u0433\u043b\u043e\u0432\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445:<\/p>\n<pre><code class=\"cs\">[AutoVisitable&lt;Element&gt;] public partial class ElementA : Element;  [AutoVisitable&lt;Element&gt;] public partial class ElementB : Element; <\/code><\/pre>\n<p> \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043a\u043e\u0440\u043d\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438? \u041d\u0435\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u043b\u043e \u0431\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u00ab\u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u0438\u00bb \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0438, \u0432\u044b\u043d\u043e\u0441\u044f \u043d\u0435\u043a\u0438\u0439 \u043e\u0431\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u044b:<\/p>\n<pre><code class=\"cs\">[AutoVisitable&lt;Element&gt;] public partial class ElementA : ParticularElement;  public abstract class ParticularElement : Element; <\/code><\/pre>\n<p> <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0410 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u044b?<\/font><\/h3>\n<p> \u041a\u043e\u0433\u0434\u0430 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u043f\u0440\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u0441\u0432\u043e\u0451\u043c \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b\u0435, \u043e\u0434\u0438\u043d \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0437\u0430\u0434\u0430\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441:<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/st\/ho\/fx\/sthofxoq435fhnydnivmpkif56s.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/st\/ho\/fx\/sthofxoq435fhnydnivmpkif56s.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/st\/ho\/fx\/sthofxoq435fhnydnivmpkif56s.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u044b? \u041c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434 \u2014 \u044d\u0442\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432.<\/p>\n<p> \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 C# \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435\u0442, \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>dynamic<\/code>. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430\u0434 \u0447\u0438\u0441\u043b\u043e\u043c, \u0442\u043e\u0433\u0434\u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cs\">public interface INumber {     INumber Add(INumber number); }  record MyInt(int Val) : INumber; record MyRational(int Num, int Den) : INumber; <\/code><\/pre>\n<p> \u041f\u043e \u0441\u0443\u0442\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">record MyInt(int Val) : INumber {     public INumber Add(INumber number) =&gt; Add((dynamic)number);      private INumber Add(MyInt myInt) =&gt; new MyInt(Val + myInt.Val);      private INumber Add(MyRational myRational) =&gt;         myRational with { Num = Val * myRational.Den + myRational.Num }; } <\/code><\/pre>\n<p> \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u043d\u0435 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u0437\u0430\u0434\u0430\u0447\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438\u0437\u043a\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438\u0437-\u0437\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0435 \u0432\u044b\u0448\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043d\u043e\u0439 \u043d\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0442\u043e\u0433\u0438<\/font><\/h2>\n<p> <\/p>\n<ul>\n<li>\u041e\u0441\u0432\u0435\u0436\u0438\u043b\u0438 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0435 Visitor.<\/li>\n<li>\u041f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u043a\u0435\u0439\u0441\u0430\u043c\u0438 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0423\u0432\u0438\u0434\u0435\u043b\u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u043e\u0432\u0443\u044e \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u0431\u0435\u0437 downcasting\u2019\u0430.<\/li>\n<li>\u041f\u043e\u0433\u0440\u0443\u0437\u0438\u043b\u0438\u0441\u044c \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/li>\n<li>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043b\u0438, \u0447\u0442\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432.<\/li>\n<li>\u041d\u0443 \u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0430 \u0414\u0436\u0430\u0432\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043d\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u0448\u044c!<\/li>\n<\/ul>\n<p> \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0432\u0435\u0437\u0434\u0443 GitHub \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <a href=\"https:\/\/github.com\/stepami\/visitor-net\">github.com\/stepami\/visitor-net<\/a>.<\/p>\n<p> \u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 NuGet \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<ul>\n<li>\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u2014 <a href=\"https:\/\/www.nuget.org\/packages\/Visitor.NET\">www.nuget.org\/packages\/Visitor.NET<\/a><\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u2014 <a href=\"https:\/\/www.nuget.org\/packages\/Visitor.NET.AutoVisitableGen\">www.nuget.org\/packages\/Visitor.NET.AutoVisitableGen<\/a><\/li>\n<\/ul>\n<p> \u0415\u0449\u0451 \u044f \u0432\u0435\u0434\u0443 Telegram-\u043a\u0430\u043d\u0430\u043b <a href=\"https:\/\/t.me\/+MgLRLb8ZSVAxNTY6\">StepOne<\/a>, \u043a\u0443\u0434\u0430 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043f\u0440\u043e \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430 C#, \u0434\u0430\u044e \u043a\u0430\u0440\u044c\u0435\u0440\u043d\u044b\u0435 \u0441\u043e\u0432\u0435\u0442\u044b, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438\u0437 \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430 \u0438 \u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u044e \u0432\u0441\u0435 \u0442\u0430\u0439\u043d\u044b IT-\u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438.<\/p>\n<p> \u00a9 2025 \u041e\u041e\u041e \u00ab\u041c\u0422 \u0424\u0418\u041d\u0410\u041d\u0421\u00bb<\/p>\n<blockquote><p><b><font color=\"#3AC1EF\"><a href=\"https:\/\/t.me\/ruvds_community\">Telegram-\u043a\u0430\u043d\u0430\u043b \u0441\u043e \u0441\u043a\u0438\u0434\u043a\u0430\u043c\u0438, \u0440\u043e\u0437\u044b\u0433\u0440\u044b\u0448\u0430\u043c\u0438 \u043f\u0440\u0438\u0437\u043e\u0432 \u0438 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 IT \ud83d\udcbb<\/a><\/font><\/b><\/p><\/blockquote>\n<p><a href=\"https:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=Stefanio&amp;utm_content=takogo_posetitelya_vy_eshhyo_ne_videli_visitor_net\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yo\/se\/km\/yosekm4h_f7y7oia-ghbbpc0phi.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yo\/se\/km\/yosekm4h_f7y7oia-ghbbpc0phi.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yo\/se\/km\/yosekm4h_f7y7oia-ghbbpc0phi.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/896752\/\"> https:\/\/habr.com\/ru\/articles\/896752\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/896752\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/mg\/a7\/rz\/mga7rzr4rlmtiqcnzjodupjmvmg.jpeg 781w\" loading=\"lazy\" decode=\"async\"\/><\/a><\/p>\n<p> \u00ab\u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u044c\u00bb (visitor) \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0411\u0430\u043d\u0434\u044b \u0427\u0435\u0442\u044b\u0440\u0451\u0445.<\/p>\n<p> \u041d\u0430 \u044f\u0437\u044b\u043a\u0435 C# \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u043c\u0435\u044e\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p> \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u0435\u0441\u044c \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u043e\u0432\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430, \u043b\u0438\u0448\u0451\u043d\u043d\u0443\u044e \u043e\u0437\u0432\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0433\u0438\u0431\u043a\u043e\u0433\u043e \u0438 \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430!<\/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-459238","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459238","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=459238"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459238\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459238"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459238"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459238"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}