{"id":3476,"date":"2023-05-30T01:11:14","date_gmt":"2023-05-29T17:11:14","guid":{"rendered":"https:\/\/lonelinerd.com\/?p=3476"},"modified":"2023-06-04T01:03:42","modified_gmt":"2023-06-03T17:03:42","slug":"event","status":"publish","type":"post","link":"https:\/\/lonelinerd.com\/index.php\/2023\/05\/30\/event\/","title":{"rendered":"C#\u7b46\u8a18 \u2013 \u4e8b\u4ef6"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3476\" class=\"elementor elementor-3476\">\n\t\t\t\t\t\t<div class=\"elementor-inner\">\n\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6baa6fe elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6baa6fe\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9cdec9e\" data-id=\"9cdec9e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ee73713 elementor-widget elementor-widget-text-editor\" data-id=\"ee73713\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">CLR\u4e8b\u4ef6\u6a21\u578b\u4ee5<\/span><a href=\"https:\/\/lonelinerd.com\/index.php\/2023\/05\/11\/delegate\/\"><span class=\"md-html-inline\" spellcheck=\"false\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u59d4\u6258<\/span><\/strong><\/span><\/span><\/a><span class=\"md-plain\">\u70ba\u57fa\u790e<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u59d4\u6258\u4ee5\u985e\u578b\u5b89\u5168\u7684\u65b9\u5f0f\u8abf\u7528\u56de\u8abf<\/span><\/strong><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span class=\"md-plain\">\u5c0d\u8c61\u6191\u85c9\u56de\u8abf\u65b9\u6cd5\u63a5\u6536\u5b83\u5011\u8a02\u95b1\u7684\u901a\u77e5<\/span><\/span><\/strong><\/span><\/p><\/li><li><span class=\"md-html-inline\" style=\"font-style: inherit; font-weight: inherit;\" spellcheck=\"false\"><span style=\"color: red;\">\u901a\u5e38\u662f\u70ba\u4e86\u97ff\u61c9\u63d0\u4f9b\u4e8b\u4ef6\u7684\u985e\u578b\/\u5c0d\u8c61\u7684\u72c0\u614b\u7684\u6539\u8b8a\uff08\u56de\u8abf\uff09\uff0c<\/span><\/span><span style=\"font-style: inherit; font-weight: inherit;\">\u901a\u77e5\u5176\u4ed6\u5c0d\u8c61\u767c\u751f\u4e86\u7279\u5b9a\u7684\u4e8b\u60c5<\/span><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e8b\u4ef6\u5305\u542b\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5141\u8a31\u975c\u614b\/\u5be6\u4f8b\u65b9\u6cd5<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u767b\u8a18\u5c0d\u4e8b\u4ef6\u95dc\u6ce8\u7684\u65b9\u6cd5<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5141\u8a31\u975c\u614b\/\u5be6\u4f8b\u65b9\u6cd5<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u6ce8\u92b7\u5c0d\u4e8b\u4ef6\u95dc\u6ce8\u7684\u65b9\u6cd5<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4e00\u500b\u7dad\u8b77\u5df2\u767b\u8a18\u7684\u65b9\u6cd5\u96c6\u7684\u59d4\u6258\u5b57\u6bb5<\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span style=\"color: red; font-weight: bold; font-style: inherit;\">\u5df2\u767b\u8a18\u65b9\u6cd5\u7684\u5217\u8868\uff0c\u4e8b\u4ef6\u767c\u751f\u5f8c\uff0c\u5c07\u901a\u77e5\u5217\u8868\u4e2d\u6240\u6709\u5df2\u767b\u8a18\u7684\u65b9\u6cd5<\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"c#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span> <span class=\"cm-variable\">someEvent;<\/span><\/span><\/pre><\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-371e196 elementor-widget elementor-widget-text-editor\" data-id=\"371e196\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u975c\u614b\u4e8b\u4ef6<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8b93\u985e\u578b\u5411\u4e00\u500b\/\u591a\u500b\u975c\u614b\/\u5be6\u4f8b\u65b9\u6cd5\u767c\u9001\u901a\u77e5<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5be6\u4f8b\u4e8b\u4ef6<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8b93\u5c0d\u8c61\u5411\u4e00\u500b\/\u591a\u500b\u975c\u614b\/\u5be6\u4f8b\u65b9\u6cd5\u767c\u9001\u901a\u77e5<\/span><\/p><\/li><\/ul><\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-706b3c0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"706b3c0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c45d391\" data-id=\"c45d391\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0354897 elementor-widget elementor-widget-text-editor\" data-id=\"0354897\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h5 class=\"md-end-block md-heading\"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u8981\u516c\u958b\u4e8b\u4ef6\u7684\u985e\u578b\u8a2d\u8a08<\/span><\/span><\/span><\/strong><\/h5><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e00\u3001\u5b9a\u7fa9\u5bb9\u7d0d\u6240\u6709\u9700\u8981<\/span><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u767c\u9001\u7d66\u4e8b\u4ef6\u901a\u77e5\u63a5\u6536\u8005\u7684\u9644\u52a0\u4fe1\u606f\uff08\u4e8b\u4ef6\u53c3\u6578\uff09\u985e<\/span><\/span><\/span><\/strong><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8a72\u985e<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u7e7c\u627f\u81eaSystem.EventArgs<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">TestArgs<\/span> : <span class=\"cm-variable\">EventArgs<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">private<\/span> <span class=\"cm-keyword\">readonly<\/span> <span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">x<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">X<\/span> { <span class=\"cm-keyword\">get<\/span> { <span class=\"cm-keyword\">return<\/span> <span class=\"cm-variable\">x<\/span>; } }<br \/><\/span><span role=\"presentation\"><span class=\"cm-keyword\">    <br \/>    public<\/span> <span class=\"cm-variable\">TestArgs<\/span>(<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">x<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0 <span class=\"cm-keyword\">this<\/span>.<span class=\"cm-variable\">x<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-variable\">x<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">} \u00a0<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e8c\u3001\u5b9a\u7fa9<\/span><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4e8b\u4ef6\u6210\u54e1<\/span><\/span><\/span><\/strong><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4f7f\u7528<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">event\u95dc\u9375\u5b57<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u5b9a\u7fa9\u4e00\u500b<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u59d4\u6258\u985e\u578b<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u7684\u6210\u54e1<\/span><\/p><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">TestArgs<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">newEvent<\/span>;<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">newEvent\u70ba\u4e8b\u4ef6\u540d\uff1b\u6210\u54e1\u985e\u578b\u70baEventHandler<\/span><span class=\"md-tag md-raw-inline\" spellcheck=\"false\">&lt;TestArgs&gt;<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u610f\u5473\u8457<\/span><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u6240\u6709\u300c\u4e8b\u4ef6\u901a\u77e5\u300d\u7684\u63a5\u6536\u8005\u90fd\u5fc5\u9808\u63d0\u4f9b\u4e00\u500b\u548cEventHandler<\/span><\/span><\/span><\/strong><\/span><span class=\"md-tag md-raw-inline\" spellcheck=\"false\">&lt;TestArgs&gt;<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u59d4\u6258\u7684\u7c3d\u540d\u5339\u914d\u7684\u56de\u8abf\u65b9\u6cd5<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">delegate<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">TEventArgs<\/span><span class=\"cm-operator\">&gt;<\/span>(<span class=\"cm-variable-3\">object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">TEventArgs<\/span> <span class=\"cm-variable\">args<\/span>);<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u65b9\u6cd5\u5fc5\u9808\u5177\u6709\u4ee5\u4e0b\u5f62\u5f0f\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">MethodName<\/span>(<span class=\"cm-variable-3\">Object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">TestArgs<\/span> <span class=\"cm-variable\">e<\/span>){ }<\/span><\/pre><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e09\u3001\u5b9a\u7fa9<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5f15\u767c\u4e8b\u4ef6\u7684\u65b9\u6cd5<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u4f86\u901a\u77e5\u4e8b\u4ef6\u7684\u767b\u8a18\u5c0d\u8c61<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u4e00\u500b\u63a5\u6536\u4e00\u500b\u53c3\u6578\uff08EventArgs\uff09\u7684\u4fdd\u8b77\u865b\u65b9\u6cd5<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">protected<\/span> <span class=\"cm-keyword\">virtual<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Raise<\/span>(<span class=\"cm-variable\">TestArgs<\/span> <span class=\"cm-variable\">arg<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">newEvent<\/span><span class=\"cm-operator\">?<\/span>.<span class=\"cm-variable\">Invoke<\/span>(<span class=\"cm-keyword\">this<\/span>, <span class=\"cm-variable\">arg<\/span>);<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u56db\u3001\u5b9a\u7fa9\u65b9\u6cd5\u4f7f\u8f38\u5165\u8f49\u5316\u70ba\u4e8b\u4ef6\u7684\u5f15\u767c<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">InputSimulation<\/span>(<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">x<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">TestArgs<\/span> <span class=\"cm-variable\">arg<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">TestArgs<\/span>(<span class=\"cm-variable\">x<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">Raise<\/span>(<span class=\"cm-variable\">arg<\/span>);<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/li><\/ul><div class=\"md-hr md-end-block\" tabindex=\"-1\"><hr \/><\/div>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9ee4f8f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9ee4f8f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bb94e84\" data-id=\"bb94e84\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9d2fc7d elementor-widget elementor-widget-text-editor\" data-id=\"9d2fc7d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h5 class=\"md-end-block md-heading\"><strong><span class=\"md-plain\">\u7de8\u8b6f\u5668\u4e2d\u7684\u4e8b\u4ef6\u5be6\u73fe<\/span><\/strong><\/h5><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6bd4\u5982\u8072\u660e\u4e86\u4e00\u500b\u4e8b\u4ef6\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">TestArgs<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">newEvent<\/span>;<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">C#\u7de8\u8b6f\u5668\u7de8\u8b6f\u6642\u6703\u5c07\u5b83\u8f49\u63db\u4ee5\u4e0b3\u500b\u69cb\u9020<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b8c2305 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b8c2305\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8ab93d5\" data-id=\"8ab93d5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a6743f1 elementor-widget elementor-widget-image\" data-id=\"a6743f1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"609\" height=\"188\" src=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_1.png\" class=\"attachment-large size-large wp-image-2202\" alt=\"\" srcset=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_1.png 609w, https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_1-300x93.png 300w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-0eeae6e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"0eeae6e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-1b26c56\" data-id=\"1b26c56\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7322d8b elementor-widget elementor-widget-text-editor\" data-id=\"7322d8b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<ul class=\"ul-list\" data-mark=\"-\"><li style=\"list-style-type: none;\"><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item md-focus-container\"><p class=\"md-end-block md-p md-focus\"><span class=\"md-pair-s md-expand\"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u79c1\u6709\u59d4\u6258\u5b57\u6bb5<\/span><\/span><\/span><\/strong><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8a72\u5b57\u6bb5\u662f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5c0d\u4e00\u500b\u59d4\u6258\u5217\u8868\u7684\u982d\u90e8\u7684\u5f15\u7528\uff0c\u4e8b\u4ef6\u767c\u751f\u6642\u6703\u901a\u77e5\u9019\u500b\u5217\u8868\u4e2d\u7684\u59d4\u6258<\/span><\/strong><\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u4e00\u500b\u65b9\u6cd5\u901a\u904e\u300c\u6dfb\u52a0\u95dc\u6ce8\u300d\u65b9\u6cd5\u767b\u8a18\u5c0d\u4e8b\u4ef6\u7684\u95dc\u6ce8\u6642\uff0c\u8a72\u5b57\u6bb5\u6703\u5f15\u7528EventHandler<\/span><\/strong><\/span><\/span><\/span><span class=\"md-tag md-raw-inline\" spellcheck=\"false\">&lt;TestArgs&gt;<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u59d4\u6258\u7684\u5be6\u4f8b\uff0c\u9019\u500b\u59d4\u6258\u53c8\u53ef\u4ee5\u5f15\u7528\u66f4\u591a\u7684EventHandler<\/span><\/strong><\/span><\/span><\/span><span class=\"md-tag md-raw-inline\" spellcheck=\"false\">&lt;TestArgs&gt;<\/span><span class=\"md-pair-s\"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u59d4\u6258\u5be6\u4f8b<\/span><\/span><\/span><\/strong><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5373\u4f7f\u8072\u660e\u4e8b\u4ef6\u5b57\u6bb5\u6642\u5c07\u5176\u8072\u660e\u70bapublic\uff0c\u5176<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u7de8\u8b6f\u5f8c\u7684\u59d4\u6258\u5b57\u6bb5\u4e5f\u59cb\u7d42\u662fprivate<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\uff0c\u9632\u6b62\u985e\u5916\u90e8\u7684\u4ee3\u78bc\u4e0d\u6b63\u78ba\u5730\u64cd\u7e31\u5b83<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u516c\u5171\u300c\u6dfb\u52a0\u95dc\u6ce8\u300d\u65b9\u6cd5<\/span><\/strong><\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">.method public hidebysig specialname instance void <\/span><br \/><span role=\"presentation\">add_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; 'value') cil managed<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) <\/span><br \/><span role=\"presentation\">\/\/ \u7a0b\u5f0f\u78bc\u5927\u5c0f \u00a0 \u00a0 \u00a0 41 (0x29)<\/span><br \/><span role=\"presentation\">.maxstack  3<\/span><br \/><span role=\"presentation\">.locals init (class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_0,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_1,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_2)<\/span><br \/><span role=\"presentation\">IL_0000:  ldarg.0<\/span><br \/><span role=\"presentation\">IL_0001:  ldfld \u00a0 \u00a0  class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; CLR_Ch11.Program::newEvent<\/span><br \/><span role=\"presentation\">IL_0006:  stloc.0<\/span><br \/><span role=\"presentation\">IL_0007:  ldloc.0<\/span><br \/><span role=\"presentation\">IL_0008:  stloc.1<\/span><br \/><span role=\"presentation\">IL_0009:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_000a:  ldarg.1<\/span><br \/><span role=\"presentation\">IL_000b:  call \u00a0 \u00a0 \u00a0 class [System.Runtime]System.Delegate [System.Runtime]System.Delegate::Combine(class [System.Runtime]System.Delegate,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.Delegate)<\/span><br \/><span role=\"presentation\">IL_0010:  castclass  class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;<\/span><br \/><span role=\"presentation\">IL_0015:  stloc.2<\/span><br \/><span role=\"presentation\">IL_0016:  ldarg.0<\/span><br \/><span role=\"presentation\">IL_0017:  ldflda \u00a0 \u00a0 class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; CLR_Ch11.Program::newEvent<\/span><br \/><span role=\"presentation\">IL_001c:  ldloc.2<\/span><br \/><span role=\"presentation\">IL_001d:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_001e:  call \u00a0 \u00a0 \u00a0 !!0 [System.Threading]System.Threading.Interlocked::CompareExchange&lt;class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;&gt;(!!0&amp;,<\/span><br \/><span role=\"presentation\">!!0,<\/span><br \/><span role=\"presentation\">!!0)<\/span><br \/><span role=\"presentation\">IL_0023:  stloc.0<\/span><br \/><span role=\"presentation\">IL_0024:  ldloc.0<\/span><br \/><span role=\"presentation\">IL_0025:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_0026:  bne.un.s \u00a0 IL_0007<\/span><br \/><span role=\"presentation\">IL_0028:  ret<\/span><br \/><span role=\"presentation\">} \/\/ end of method Program::add_newEvent<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8a72\u65b9\u6cd5\u5141\u8a31\u4e86\u5176\u4ed6\u5c0d\u8c61\u767b\u8a18\u5c0d\u4e8b\u4ef6\u7684\u95dc\u6ce8\uff0c\u8abf\u7528\u4e86<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">System.Delegate\u7684\u975c\u614bCombine<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u65b9\u6cd5\u5c07\u59d4\u6258\u5be6\u4f8b\u6dfb\u52a0\u5230\u59d4\u6258\u5217\u8868\u4e2d\uff0c\u8fd4\u56de\u65b0\u7684\u5217\u8868\u982d\uff0c\u5b58\u56de\u5230\u4e0a\u9762\u7684\u79c1\u6709\u59d4\u6258\u5b57\u6bb5\u4e2d<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u516c\u5171\u300c\u79fb\u9664\u95dc\u6ce8\u300d\u65b9\u6cd5<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">.method public hidebysig specialname instance void <\/span><br \/><span role=\"presentation\">remove_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; 'value') cil managed<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) <\/span><br \/><span role=\"presentation\">\/\/ \u7a0b\u5f0f\u78bc\u5927\u5c0f \u00a0 \u00a0 \u00a0 41 (0x29)<\/span><br \/><span role=\"presentation\">.maxstack  3<\/span><br \/><span role=\"presentation\">.locals init (class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_0,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_1,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; V_2)<\/span><br \/><span role=\"presentation\">IL_0000:  ldarg.0<\/span><br \/><span role=\"presentation\">IL_0001:  ldfld \u00a0 \u00a0  class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; CLR_Ch11.Program::newEvent<\/span><br \/><span role=\"presentation\">IL_0006:  stloc.0<\/span><br \/><span role=\"presentation\">IL_0007:  ldloc.0<\/span><br \/><span role=\"presentation\">IL_0008:  stloc.1<\/span><br \/><span role=\"presentation\">IL_0009:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_000a:  ldarg.1<\/span><br \/><span role=\"presentation\">IL_000b:  call \u00a0 \u00a0 \u00a0 class [System.Runtime]System.Delegate [System.Runtime]System.Delegate::Remove(class [System.Runtime]System.Delegate,<\/span><br \/><span role=\"presentation\">class [System.Runtime]System.Delegate)<\/span><br \/><span role=\"presentation\">IL_0010:  castclass  class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;<\/span><br \/><span role=\"presentation\">IL_0015:  stloc.2<\/span><br \/><span role=\"presentation\">IL_0016:  ldarg.0<\/span><br \/><span role=\"presentation\">IL_0017:  ldflda \u00a0 \u00a0 class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; CLR_Ch11.Program::newEvent<\/span><br \/><span role=\"presentation\">IL_001c:  ldloc.2<\/span><br \/><span role=\"presentation\">IL_001d:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_001e:  call \u00a0 \u00a0 \u00a0 !!0 [System.Threading]System.Threading.Interlocked::CompareExchange&lt;class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;&gt;(!!0&amp;,<\/span><br \/><span role=\"presentation\">!!0,<\/span><br \/><span role=\"presentation\">!!0)<\/span><br \/><span role=\"presentation\">IL_0023:  stloc.0<\/span><br \/><span role=\"presentation\">IL_0024:  ldloc.0<\/span><br \/><span role=\"presentation\">IL_0025:  ldloc.1<\/span><br \/><span role=\"presentation\">IL_0026:  bne.un.s \u00a0 IL_0007<\/span><br \/><span role=\"presentation\">IL_0028:  ret<\/span><br \/><span role=\"presentation\">} \/\/ end of method Program::remove_newEvent<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8a72\u65b9\u6cd5\u5141\u8a31\u4e86\u5176\u4ed6\u5c0d\u8c61\u6ce8\u92b7\u5c0d\u4e8b\u4ef6\u7684\u95dc\u6ce8\uff0c\u8abf\u7528\u4e86<\/span><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">System.Delegate\u7684\u975c\u614bRemove<\/span><\/span><\/span><\/strong><\/span><span class=\"md-plain\">\u65b9\u6cd5\uff0c\u5c07\u59d4\u6258\u5be6\u4f8b\u5f9e\u59d4\u6258\u5217\u8868\u4e2d\u522a\u9664\uff0c\u8fd4\u56de\u65b0\u7684\u5217\u8868\u982d\u5f15\u7528\u81f3\u4e0a\u9762\u7684\u79c1\u6709\u59d4\u6258\u5b57\u6bb5\u4e2d<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e0a\u8ff0\u7684\u300c\u6dfb\u52a0\u300d\u548c\u300c\u79fb\u9664\u300d\u65b9\u6cd5\u90fd\u662f\u516c\u5171\u7684\uff0c\u662f\u56e0\u70ba\u4e8b\u4ef6\u5b57\u6bb5\u88ab\u5b9a\u7fa9\u70ba\u516c\u5171\u7684\u3002<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u96d6\u7136\u4e8b\u4ef6\u5b57\u6bb5\u7de8\u8b6f\u5f8c\u8f49\u63db\u6210\u7684\u59d4\u6258\u69cb\u9020\u7121\u8ad6\u5982\u4f55\u90fd\u662fprivate\u7684\uff0c\u4f46\u662f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u300c\u6dfb\u52a0\u300d\u548c\u300c\u79fb\u9664\u300d\u65b9\u6cd5\u7684\u53ef\u8a2a\u554f\u6027\u8207\u4e8b\u4ef6\u5b57\u6bb5\u7684\u5b9a\u7fa9\u4fdd\u6301\u4e00\u81f4<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u610f\u5473\u8457<\/span><span class=\"md-pair-s \"><strong><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4e8b\u4ef6\u7684\u53ef\u8a2a\u554f\u6027\u6c7a\u5b9a\u4e86\u751a\u9ebc\u4ee3\u78bc\u80fd\u767b\u8a18\u548c\u6ce8\u92b7\u5c0d\u4e8b\u4ef6\u7684\u95dc\u6ce8<\/span><\/span><\/span><\/strong><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u7121\u8ad6\u5982\u4f55\u90fd\u53ea\u6709\u985e\u578b\u672c\u8eab\u624d\u80fd\u76f4\u63a5\u8a2a\u554f\u59d4\u6258\u5b57\u6bb5<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u4e8b\u4ef6\u4e5f\u53ef\u4ee5\u88ab\u5b9a\u7fa9\u70bavirtual\u6216\u8005static\u7684\uff0c\u5982\u6b64\u4e00\u4f86\uff0c\u5176\u751f\u6210\u7684add\u548cremove\u65b9\u6cd5\u4e5f\u6703\u88ab\u6a19\u8a18\u70bastatic\/virtual<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item md-focus-container\"><p class=\"md-end-block md-p md-focus\"><span class=\"md-plain\">\u53e6\u5916\uff0c\u7de8\u8b6f\u5668\u9084\u6703\u5728\u5143\u6578\u64da\u4e2d\u751f\u6210\u4e00\u500b<\/span><span class=\"md-html-inline md-expand\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u300c\u4e8b\u4ef6\u5b9a\u7fa9\u8a18\u9304\u9805\u300d<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-260dd7c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"260dd7c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-248edee\" data-id=\"248edee\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3ad199a elementor-widget elementor-widget-image\" data-id=\"3ad199a\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-image\">\n\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"578\" height=\"213\" src=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_2.png\" class=\"attachment-large size-large wp-image-2203\" alt=\"\" srcset=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_2.png 578w, https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_11_2-300x111.png 300w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d177704 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d177704\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ff3fd42\" data-id=\"ff3fd42\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-950ca0c elementor-widget elementor-widget-text-editor\" data-id=\"950ca0c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<ul><li style=\"list-style-type: none;\"><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">.event class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt; newEvent<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">.addon instance void CLR_Ch11.Program::add_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;)<\/span><br \/><span role=\"presentation\">.removeon instance void CLR_Ch11.Program::remove_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;)<\/span><br \/><span role=\"presentation\">} \/\/ end of event Program::newEvent<\/span><\/pre><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">Event #1 (14000001)<\/span><br \/><span role=\"presentation\">-------------------------------------------------------<\/span><br \/><span role=\"presentation\">Name \u00a0 \u00a0  : newEvent (14000001)<\/span><br \/><span role=\"presentation\">Flags \u00a0 \u00a0 : [none] (00000000)<\/span><br \/><span role=\"presentation\">EventType : 1B000001 [TypeSpec]<\/span><br \/><span role=\"presentation\">AddOnMethd: (06000001) add_newEvent<\/span><br \/><span role=\"presentation\">RmvOnMethd: (06000002) remove_newEvent<\/span><br \/><span role=\"presentation\">FireMethod: (06000000) <\/span><br \/><span role=\"presentation\">0 OtherMethods<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8a72\u8a18\u9304\u9805\u5305\u542b\u4e86\u4e00\u4e9bflag\u548c\u57fa\u790e\u59d4\u6258\u985e\u578b\uff0c\u4e3b\u8981\u662f\u985e\u4f3c\u5c6c\u6027\uff08Property\uff09\u4e00\u6a23\uff0c<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5f15\u7528\u4e86\u81ea\u8eab\u7684\u300c\u8a2a\u554f\u5668\u65b9\u6cd5\u300d\u2014\u2014 \u300cadd\u300d\u548c\u300cremove\u300d<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u53ef\u4ee5\u901a\u904e<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">System.Reflection.EventInfo<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u7372\u53d6\u9019\u4e9b\u4fe1\u606f<\/span><\/p><\/li><\/ul><\/li><li class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><span class=\"md-plain\">\u4e8b\u4ef6\u95dc\u6ce8\u7684\u6dfb\u52a0\u8207\u79fb\u9664<\/span><\/span><\/span><\/span><\/li><li style=\"list-style-type: none;\"><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4f7f\u7528<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">+= \/ -=<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\"> \u9032\u884c<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">C#\u7de8\u8b6f\u5668\u5167\u7f6e\u4e86\u5c0d\u4e8b\u4ef6\u7684\u652f\u6301\uff0c\u6703\u5c07+=\/-=\u64cd\u4f5c\u7b26\u7ffb\u8b6f\u6210\u5c0d\u61c9\u7684\u300c\u4e8b\u4ef6\u95dc\u6ce8\u6dfb\u52a0\/\u79fb\u9664\u65b9\u6cd5\u300d\u7684\u8abf\u7528<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6dfb\u52a0\uff08+=\uff09<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">TestArgs<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">newEvent<\/span>;<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">MethodName<\/span>(<span class=\"cm-variable-3\">Object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">TestArgs<\/span> <span class=\"cm-variable\">e<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Debug Somthing\"<\/span>);<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">AddEvent<\/span>()<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">newEvent<\/span> <span class=\"cm-operator\">+=<\/span> <span class=\"cm-variable\">MethodName<\/span>;<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">\/\/Add Event<\/span><br \/><span role=\"presentation\">.method public hidebysig instance void  AddEvent() cil managed<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">\/\/...<\/span><br \/><span role=\"presentation\">IL_000e:  call \u00a0 \u00a0 \u00a0 instance void CLR_Ch11.Program::add_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;)<\/span><br \/><span role=\"presentation\">\/\/...<\/span><br \/><span role=\"presentation\">} \/\/ end of method Program::AddEvent<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u79fb\u9664\uff08-=\uff09<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">TestArgs<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">newEvent<\/span>;<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">MethodName<\/span>(<span class=\"cm-variable-3\">Object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">TestArgs<\/span> <span class=\"cm-variable\">e<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Debug Somthing\"<\/span>);<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">RemoveEvent<\/span>()<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">newEvent<\/span> <span class=\"cm-operator\">-=<\/span> <span class=\"cm-variable\">MethodName<\/span>;<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"IL\" spellcheck=\"false\"><span role=\"presentation\">\/\/Remove Event<\/span><br \/><span role=\"presentation\">.method public hidebysig instance void  RemoveEvent() cil managed<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">\/\/...<\/span><br \/><span role=\"presentation\">IL_000e:  call \u00a0 \u00a0 \u00a0 instance void CLR_Ch11.Program::remove_newEvent(class [System.Runtime]System.EventHandler`1&lt;class CLR_Ch11.TestArgs&gt;)<\/span><br \/><span role=\"presentation\">\/\/...<\/span><br \/><span role=\"presentation\">} \/\/ end of method Program::RemoveEvent<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item md-focus-container\"><p class=\"md-end-block md-p md-focus\"><span class=\"md-html-inline md-expand\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5c0d\u8c61\u4e0d\u518d\u5e0c\u671b\u63a5\u6536\u4e8b\u4ef6\u901a\u77e5\u6642\uff0c\u9700\u8981\u6ce8\u92b7\u5c0d\u4e8b\u4ef6\u7684\u95dc\u6ce8\u3002\u56e0\u70ba\u53ea\u8981\u5c0d\u8c61\u5411\u4e8b\u4ef6\u767b\u8a18\u4e86\u5b83\u7684\u4e00\u500b\u65b9\u6cd5\uff0c\u8a72\u5c0d\u8c61\u5c31\u4e0d\u80fd\u88ab\u56de\u6536<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul><\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5202891 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5202891\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ea5ad94\" data-id=\"ea5ad94\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9ce4f63 elementor-widget elementor-widget-text-editor\" data-id=\"9ce4f63\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h5 class=\"md-end-block md-heading\"><strong><span class=\"md-plain\">\u986f\u5f0f\u5be6\u73fe\u4e8b\u4ef6<\/span><\/strong><\/h5><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5982\u679c\u4e00\u500b\u985e\u6709n\u500b\u4e8b\u4ef6\uff0c\u5168\u90e8\u90fd\u76f4\u63a5<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u7528event\u95dc\u9375\u5b57\u4f86\u5b9a\u7fa9\uff0c\u90a3\u9ebc\u5b83\u5c31\u6703\u81ea\u52d5\u751f\u6210n\u500b\u4e0a\u9762\u7684\u7de8\u8b6f\u5f8c\u7d50\u69cb<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u70ba\u4e86\u63d0\u5347\u6548\u7387\uff0c\u6bd4\u8f03\u597d\u7684\u65b9\u6848\u662f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u300c\u986f\u5f0f\u5be6\u73fe\u300d\u6211\u5011\u91cd\u9ede\u95dc\u6ce8\u7684\u4e8b\u4ef6<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u516c\u958b\u4e86\u4e8b\u4ef6\u7684\u6bcf\u500b\u5c0d\u8c61\u90fd\u61c9\u7dad\u8b77\u4e00\u500b\u96c6\u5408\uff08\u4e00\u822c\u662f\u5b57\u5178\uff09\uff0c\u4ee5\u67d0\u7a2e\u4e8b\u4ef6\u6a19\u8b58\u7b26\uff08\u5982\u679a\u8209\uff09\u70ba\u9375\uff0c\u5c0d\u61c9\u7684\u59d4\u6258\u5217\u8868\u70ba\u503c\u3002<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5c0d\u8c61\u69cb\u9020\u6642\uff0c\u8a72\u96c6\u5408\u662f\u7a7a\u7684<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u767b\u8a18<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u5c0d\u4e00\u500b\u4e8b\u4ef6\u7684\u95dc\u6ce8\u6642\uff0c\u6703\u5728\u96c6\u5408\u4e2d\u67e5\u627e\u4e8b\u4ef6\u7684\u6a19\u8b58\u7b26\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u627e\u5230\uff1a\u5408\u5e76\u59d4\u6258\u5217\u8868<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u627e\u4e0d\u5230\uff1a\u6dfb\u52a0\u6a19\u8b58\u7b26\u8207\u65b0\u59d4\u6258\u81f3\u96c6\u5408<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u9700\u8981<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5f15\u767c\u4e8b\u4ef6<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u6642\uff0c\u6703\u5728\u96c6\u5408\u67e5\u627e\u4e8b\u4ef6\u6a19\u8b58\u7b26\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6c92\u6709\u627e\u5230\u5c0d\u61c9\u7684\u6a19\u8b58\u7b26\uff1a\u8aaa\u660e\u6c92\u6709\u4efb\u4f55\u5c0d\u8c61\u767b\u8a18\u5c0d\u9019\u500b\u4e8b\u4ef6\u7684\u95dc\u6ce8\uff0c\u6c92\u6709\u4efb\u4f55\u59d4\u6258\u9700\u8981\u56de\u8abf<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u627e\u5230\u4e86\u5c0d\u61c9\u7684\u6a19\u8b58\u7b26\uff1a\u904d\u6b77\u8abf\u7528\u95dc\u806f\u7684\u59d4\u6258\u5217\u8868<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u6ce8\u92b7<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u5c0d\u4e00\u500b\u4e8b\u4ef6\u7684\u95dc\u6ce8\u6642\uff0c\u5728\u96c6\u5408\u4e2d\u67e5\u627e\u4e8b\u4ef6\u7684\u6a19\u8b58\u7b26\uff1a<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u627e\u5230\uff1a\u6383\u7784\u4e26\u79fb\u9664\u6307\u5b9a\u7684\u59d4\u6258<\/span><\/strong><\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u627e\u4e0d\u5230\uff1a\u4e8b\u4ef6\u5f9e\u6c92\u6709\u88ab\u8a72\u59d4\u6258\u95dc\u6ce8\u904e<\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">Steps:<\/span><\/strong><\/span><\/span><\/span><\/p><ol class=\"ol-list\" start=\"\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5b9a\u7fa9\u4e00\u500b<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u4e8b\u4ef6\u7ba1\u7406\u5668<\/span><\/strong><\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-comment\">\/\/\/ &lt;summary&gt;<\/span><\/span><br \/><span role=\"presentation\"><span class=\"cm-comment\">\/\/\/ \u4e8b\u4ef6\u96c6\u5408\u63a7\u5236\u5668<\/span><\/span><br \/><span role=\"presentation\"><span class=\"cm-comment\">\/\/\/ &lt;\/summary&gt;<\/span><\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">sealed<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">EventSet<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">readonly<\/span> <span class=\"cm-variable\">Dictionary<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">EventKey<\/span>, <span class=\"cm-variable\">Delegate<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">events<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">Dictionary<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">EventKey<\/span>, <span class=\"cm-variable\">Delegate<\/span><span class=\"cm-operator\">&gt;<\/span>();<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Add<\/span>(<span class=\"cm-variable\">EventKey<\/span> <span class=\"cm-variable\">key<\/span>, <span class=\"cm-variable\">Delegate<\/span> <span class=\"cm-variable\">handler<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Delegate<\/span> <span class=\"cm-variable\">d<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">events<\/span>.<span class=\"cm-variable\">TryGetValue<\/span>(<span class=\"cm-variable\">key<\/span>, <span class=\"cm-keyword\">out<\/span> <span class=\"cm-variable\">d<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">events<\/span>[<span class=\"cm-variable\">key<\/span>] <span class=\"cm-operator\">=<\/span> <span class=\"cm-variable\">Delegate<\/span>.<span class=\"cm-variable\">Combine<\/span>(<span class=\"cm-variable\">d<\/span>, <span class=\"cm-variable\">handler<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Remove<\/span>(<span class=\"cm-variable\">EventKey<\/span> <span class=\"cm-variable\">key<\/span>, <span class=\"cm-variable\">Delegate<\/span> <span class=\"cm-variable\">handler<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Delegate<\/span> <span class=\"cm-variable\">d<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">if<\/span>(<span class=\"cm-variable\">events<\/span>.<span class=\"cm-variable\">TryGetValue<\/span>(<span class=\"cm-variable\">key<\/span>, <span class=\"cm-keyword\">out<\/span> <span class=\"cm-variable\">d<\/span>))<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">d<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-variable\">Delegate<\/span>.<span class=\"cm-variable\">Remove<\/span>(<span class=\"cm-variable\">d<\/span>, <span class=\"cm-variable\">handler<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">if<\/span> (<span class=\"cm-variable\">d<\/span> <span class=\"cm-operator\">!=<\/span> <span class=\"cm-atom\">null<\/span>) { <span class=\"cm-variable\">events<\/span>[<span class=\"cm-variable\">key<\/span>] <span class=\"cm-operator\">=<\/span> <span class=\"cm-variable\">d<\/span>; }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">else<\/span> { <span class=\"cm-variable\">events<\/span>.<span class=\"cm-variable\">Remove<\/span>(<span class=\"cm-variable\">key<\/span>); }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0  }<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Raise<\/span>(<span class=\"cm-variable\">EventKey<\/span> <span class=\"cm-variable\">key<\/span>, <span class=\"cm-variable-3\">object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">EventArgs<\/span> <span class=\"cm-variable\">e<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Delegate<\/span> <span class=\"cm-variable\">d<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">events<\/span>.<span class=\"cm-variable\">TryGetValue<\/span>(<span class=\"cm-variable\">key<\/span>, <span class=\"cm-keyword\">out<\/span> <span class=\"cm-variable\">d<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">d<\/span><span class=\"cm-operator\">?<\/span>.<span class=\"cm-variable\">DynamicInvoke<\/span>(<span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable-3\">object<\/span>[] { <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">e<\/span> });<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5b9a\u7fa9<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u4e8b\u4ef6\u53c3\u6578\u985e<\/span><\/strong><\/span><\/span><\/span><span class=\"md-plain\">\u548c\u5177\u9ad4<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u9700\u8981\u516c\u958b\u4e8b\u4ef6\u7684\u985e<\/span><\/strong><\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-comment\">\/\/\u4e8b\u4ef6\u53c3\u6578\u985e<\/span><\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">FooEventArgs<\/span> : <span class=\"cm-variable\">EventArgs<\/span> { }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-comment\">\/\/\u4e00\u500b\u5305\u542b\u4e86\u5f88\u591a\u4e8b\u4ef6\u7684\u985e<\/span><\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">TypeWithLotsOfEvents<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u5be6\u4f8b\u5316\u4e00\u500b\u4e8b\u4ef6\u7ba1\u7406\u5668<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">readonly<\/span> <span class=\"cm-variable\">EventSet<\/span> <span class=\"cm-variable\">m_EventSet<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">EventSet<\/span>();<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">protected<\/span> <span class=\"cm-variable\">EventSet<\/span> <span class=\"cm-variable\">EventSet<\/span> { <span class=\"cm-keyword\">get<\/span> { <span class=\"cm-keyword\">return<\/span> <span class=\"cm-variable\">m_EventSet<\/span>; } }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u4e00\u500b\u4e8b\u4ef6\u7684\u6a19\u8b58\u7b26<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">protected<\/span> <span class=\"cm-keyword\">static<\/span> <span class=\"cm-keyword\">readonly<\/span> <span class=\"cm-variable\">EventKey<\/span> <span class=\"cm-variable\">m_Key<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">EventKey<\/span>();<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u4e8b\u4ef6\u8a2a\u554f\u5668\uff0c\u7528\u65bc\u5728\u96c6\u5408\u4e2d\u589e\u522a\u59d4\u6258<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">event<\/span> <span class=\"cm-variable\">EventHandler<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">FooEventArgs<\/span><span class=\"cm-operator\">&gt;<\/span> <span class=\"cm-variable\">Foo<\/span><\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-comment\">\/\/add\/remove\u7684\u986f\u5f0f\u8abf\u7528<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u5916\u90e8\u6a21\u584a\u901a\u904e\u9019\u88e1\u5411\u8a72\u985e\u7684\u4e8b\u4ef6\u7ba1\u7406\u5668\u6dfb\u52a0\/\u79fb\u9664\u4e8b\u4ef6 \u00a0 <\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">add<\/span> { <span class=\"cm-variable\">m_EventSet<\/span>.<span class=\"cm-variable\">Add<\/span>(<span class=\"cm-variable\">m_Key<\/span>, <span class=\"cm-keyword\">value<\/span>); }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">remove<\/span> { <span class=\"cm-variable\">m_EventSet<\/span>.<span class=\"cm-variable\">Remove<\/span>(<span class=\"cm-variable\">m_Key<\/span>, <span class=\"cm-keyword\">value<\/span>); }<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u767c\u8d77\u4e8b\u4ef6\u5165\u53e3<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">protected<\/span> <span class=\"cm-keyword\">virtual<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">OnFoo<\/span>(<span class=\"cm-variable\">FooEventArgs<\/span> <span class=\"cm-variable\">e<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u57f7\u884c\u7d93\u904e\u4e0a\u9762\u7684\u8a2a\u554f\u5668\u6dfb\u52a0\u81f3\u4e8b\u4ef6\u7ba1\u7406\u5668\u7684\u56de\u8abf\u51fd\u6578<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">m_EventSet<\/span>.<span class=\"cm-variable\">Raise<\/span>(<span class=\"cm-variable\">m_Key<\/span>, <span class=\"cm-keyword\">this<\/span>, <span class=\"cm-variable\">e<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">SimulateFoo<\/span>()<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">OnFoo<\/span>(<span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">FooEventArgs<\/span>());<\/span><br \/><span role=\"presentation\"> \u00a0  } \u00a0 \u00a0 \u00a0 \u00a0<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-pair-s \"><strong><span class=\"md-plain\">\u5916\u90e8\u6a21\u584a\u4e0d\u95dc\u6ce8\u4e8b\u4ef6\u662f\u986f\u5f0f\u9084\u662f\u96b1\u5f0f\u5be6\u73fe\uff0c\u53ea\u9700\u8981\u7528\u6a19\u6e96\u8a9e\u6cd5\u9032\u884c\u4e8b\u4ef6\u7684\u767b\u8a18<\/span><\/strong><\/span><\/span><\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><pre class=\"md-fences md-end-block ty-contain-cm modeLoaded\" lang=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">static<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Main<\/span>(<span class=\"cm-variable-3\">string<\/span>[] <span class=\"cm-variable\">args<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">TypeWithLotsOfEvents<\/span> <span class=\"cm-variable\">twie<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">TypeWithLotsOfEvents<\/span>();<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">twie<\/span>.<span class=\"cm-variable\">Foo<\/span> <span class=\"cm-operator\">+=<\/span> <span class=\"cm-variable\">HandleFooEvent<\/span>;<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">twie<\/span>.<span class=\"cm-variable\">SimulateFoo<\/span>(); <span class=\"cm-comment\">\/\/Worked!<\/span><\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">private<\/span> <span class=\"cm-keyword\">static<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">HandleFooEvent<\/span>(<span class=\"cm-variable-3\">object<\/span> <span class=\"cm-variable\">sender<\/span>, <span class=\"cm-variable\">FooEventArgs<\/span> <span class=\"cm-variable\">e<\/span>)<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Handling Foo Event Here...\"<\/span>);<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/li><\/ol><\/li><\/ul><div class=\"md-hr md-end-block\" tabindex=\"-1\"><hr \/><\/div><div class=\"md-hr md-end-block\" tabindex=\"-1\"><hr \/><\/div>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-88fb6ea elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"88fb6ea\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2ef47e7\" data-id=\"2ef47e7\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5d2a36b elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"5d2a36b\" data-element_type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-cf6e0ad elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cf6e0ad\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t\t\t<div class=\"elementor-row\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0a21b93\" data-id=\"0a21b93\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-column-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-aac512b elementor-widget elementor-widget-text-editor\" data-id=\"aac512b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-text-editor elementor-clearfix\">\n\t\t\t\t<h4 class=\"md-end-block md-heading\"><span style=\"text-decoration: underline;\"><strong><span class=\"md-plain md-expand\">\u53c3\u8003\u66f8\u76ee<\/span><\/strong><\/span><\/h4><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item md-focus-container\">\u300aCLR via C#\u300b\uff08\u7b2c4\u7248\uff09 Jeffrey Richter<\/li><\/ul>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>CLR\u4e8b\u4ef6\u6a21\u578b\u4ee5\u59d4\u6258\u70ba\u57fa\u790e\uff0c\u5728\u59d4\u6258\u7684\u57fa\u790e\u4e0a\u984d\u5916\u5c01\u88dd\u4e86\u4e00\u5957\u5141\u8a31\u767b\u8a18\/\u6ce8\u92b7\u5c0d\u4e8b\u4ef6\u95dc\u6ce8\u7684\u65b9\u6cd5\u4ee5\u53ca\u4e00\u500b\u7dad\u8b77\u5df2\u767b\u8a18\u7684\u65b9\u6cd5\u96c6\u7684\u59d4\u6258\u5b57\u6bb5\uff0c\u4e8b\u4ef6\u767c\u751f\u5f8c\uff0c\u5c07\u901a\u77e5\u5217\u8868\u4e2d\u6240\u6709\u5df2\u767b\u8a18\u7684\u65b9\u6cd5<\/p>\n","protected":false},"author":1,"featured_media":947,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,27,18],"tags":[],"class_list":["post-3476","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-reading-notes","category-c-sharp","category-developing"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/lonelinerd.com\/wp-content\/uploads\/2021\/03\/FeatureCover_ReadingNotes.png","_links":{"self":[{"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts\/3476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/comments?post=3476"}],"version-history":[{"count":45,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts\/3476\/revisions"}],"predecessor-version":[{"id":3584,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts\/3476\/revisions\/3584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/media\/947"}],"wp:attachment":[{"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/media?parent=3476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/categories?post=3476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/tags?post=3476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}