{"id":3721,"date":"2023-06-11T00:07:50","date_gmt":"2023-06-10T16:07:50","guid":{"rendered":"https:\/\/lonelinerd.com\/?p=3721"},"modified":"2023-06-11T00:28:57","modified_gmt":"2023-06-10T16:28:57","slug":"interface","status":"publish","type":"post","link":"https:\/\/lonelinerd.com\/index.php\/2023\/06\/11\/interface\/","title":{"rendered":"C#\u7b46\u8a18 \u2013 \u63a5\u53e3"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3721\" class=\"elementor elementor-3721\">\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-3b9ae49 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"3b9ae49\" 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-5e5ce34\" data-id=\"5e5ce34\" 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-f7cb328 elementor-widget elementor-widget-text-editor\" data-id=\"f7cb328\" 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 md-focus\"><strong><span class=\"md-plain\">\u5b9a\u7fa9<\/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\">\u63a5\u53e3\u53ef\u4ee5\u5b9a\u7fa9\u5927\u90e8\u5206\u65b9\u6cd5\u3001\u4ee5\u53ca\u4e8b\u4ef6\u3001\u5c6c\u6027<\/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-plain\">\u4f46\u4e0d\u80fd\u5b9a\u7fa9\u69cb\u9020\u5668\u65b9\u6cd5\u548c\u5be6\u4f8b\u5b57\u6bb5<\/span><\/span><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u96d6\u7136CLR\u5141\u8a31\u63a5\u53e3\u53ef\u4ee5\u5b9a\u7fa9\u975c\u614b\u6210\u54e1\uff0c\u4f46\u662f\u7b26\u5408CLS\u6a19\u6e96\u7684\u63a5\u53e3\u4e0d\u5141\u8a31<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u56e0\u6b64\uff0c<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">C#\u7981\u6b62\u63a5\u53e3\u5b9a\u7fa9\u4efb\u4f55\u4e00\u7a2e\u975c\u614b\u6210\u54e1<\/span><\/span><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5728CLR\u770b\u4f86\uff0c\u63a5\u53e3\u5b9a\u7fa9\u5c31\u662f\u985e\u578b\u5b9a\u7fa9<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6240\u4ee5\uff0c<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">CLR\u6703\u70ba\u63a5\u53e3\u985e\u578b\u5c0d\u8c61\u5b9a\u7fa9\u300c\u5167\u90e8\u6578\u64da\u7d50\u69cb\u300d<\/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\">\u53ef\u4ee5\u901a\u904e\u53cd\u5c04\u6a5f\u5236\u4f86\u67e5\u8a62\u63a5\u53e3\u985e\u578b\u7684\u529f\u80fd<\/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-4c752c0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4c752c0\" 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-d05f2cd\" data-id=\"d05f2cd\" 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-42d6939 elementor-widget elementor-widget-text-editor\" data-id=\"42d6939\" 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\">\u7e7c\u627f<\/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\">C#\u7de8\u8b6f\u5668\u5c0d\u300c\u5be6\u73fe\u63a5\u53e3\u7684\u65b9\u6cd5\u300d\u7684\u8981\u6c42<\/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\">interface<\/span> <span class=\"cm-def\">ITestInterface<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">SealTest<\/span>();<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">VirtualTest<\/span>(); \u00a0 \u00a0 \u00a0 \u00a0<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">TestConcreteClass<\/span> : <span class=\"cm-variable\">ITestInterface<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">virtual<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">VirtualTest<\/span>(){ }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">SealTest<\/span>(){ }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6a19\u5fd7\u70ba<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">public\uff08\u5fc5\u9808\uff09<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6a19\u5fd7\u70ba<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">virtual\uff08\u53ef\u9078\uff09<\/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-plain\">\u5982\u679c\u6a19\u5fd7\u70bavirtual<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5be6\u73fe\u4e86\u63a5\u53e3\u7684\u985e\u7684\u6d3e\u751f\u985e\u5247\u53ef\u4ee5\u91cd\u5beb\u8a72\u65b9\u6cd5<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5143\u6578\u64da<\/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 #1 (06000009) <\/span><br \/><span role=\"presentation\">-------------------------------------------------------<\/span><br \/><span role=\"presentation\">MethodName: VirtualTest (06000009)<\/span><br \/><span role=\"presentation\">Flags \u00a0 \u00a0 : [Public] [Virtual] [HideBySig] [NewSlot]  (000001c6)<\/span><br \/><span role=\"presentation\">RVA \u00a0 \u00a0 \u00a0 : 0x000020d1<\/span><br \/><span role=\"presentation\">ImplFlags : [IL] [Managed]  (00000000)<\/span><br \/><span role=\"presentation\">CallCnvntn: [DEFAULT]<\/span><br \/><span role=\"presentation\">hasThis <\/span><br \/><span role=\"presentation\">ReturnType: Void<\/span><br \/><span role=\"presentation\">No arguments.<\/span><\/pre><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5982\u679c\u4e0d\u6a19\u5fd7\u70bavirtual<\/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-plain\">\u8a72\u65b9\u6cd5\u6703\u88ab\u7de8\u8b6f\u5668\u6a19\u5fd7\u70bavirtual\u548csealed\uff0c\u65b9\u6cd5\u5373\u4e0d\u80fd\u88ab\u6d3e\u751f\u985e\u6240\u8986\u5beb<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5143\u6578\u64da<\/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 #2 (0600000a) <\/span><br \/><span role=\"presentation\">-------------------------------------------------------<\/span><br \/><span role=\"presentation\">MethodName: SealTest (0600000A)<\/span><br \/><span role=\"presentation\">Flags \u00a0 \u00a0 : [Public] [Final] [Virtual] [HideBySig] [NewSlot]  (000001e6)<\/span><br \/><span role=\"presentation\">RVA \u00a0 \u00a0 \u00a0 : 0x000020d4<\/span><br \/><span role=\"presentation\">ImplFlags : [IL] [Managed]  (00000000)<\/span><br \/><span role=\"presentation\">CallCnvntn: [DEFAULT]<\/span><br \/><span role=\"presentation\">hasThis <\/span><br \/><span role=\"presentation\">ReturnType: Void<\/span><br \/><span role=\"presentation\">No arguments.<\/span><\/pre><\/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\">\u6a19\u5fd7[Final]\u4ee3\u8868\u4e86sealed<\/span><\/span><\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6d3e\u751f\u4e0d\u80fd\u91cd\u5bebsealed\u7684\u65b9\u6cd5\uff0c\u4f46\u662f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u6d3e\u751f\u985e\u53ef\u4ee5\u7e7c\u627f\u540c\u4e00\u500b\u63a5\u53e3\uff0c\u7136\u5f8c\u70ba\u53e6\u5916\u63d0\u4f9b\u81ea\u5df1\u7684\u5be6\u73fe<\/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\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">TestSonConcreteClass<\/span> : <span class=\"cm-variable\">TestConcreteClass<\/span>, <span class=\"cm-variable\">ITestInterface<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">new<\/span> <span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">SealTest<\/span>() { }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5728\u5c0d\u8c61\u4e0a\u8abf\u7528\u63a5\u53e3\u65b9\u6cd5\u6642\uff0c\u8abf\u7528\u7684\u662f\u8a72<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u65b9\u6cd5\u5728\u8a72\u5c0d\u8c61\u7684\u985e\u578b\u4e2d\u7684\u5be6\u73fe<\/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-plain\">\u8b8a\u91cf\u7684\u985e\u578b\u898f\u5b9a\u4e86\u80fd\u5c0d\u9019\u500b\u5c0d\u8c61\u57f7\u884c\u7684\u64cd\u4f5c<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5047\u8a2d\u7236\u985e\u63a5\u53e3\u65b9\u6cd5\u8f38\u51fa\u4e00\u500b&#8221;Base Test&#8221;\uff1b\u5b50\u985e\u63a5\u53e3\u65b9\u6cd5\u8f38\u51fa\u4e00\u500b&#8221;Child Test&#8221;<\/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\">class<\/span> <span class=\"cm-def\">TestConcreteClass<\/span> : <span class=\"cm-variable\">ITestInterface<\/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\">SealTest<\/span>(){ <span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Base Test\"<\/span>); }<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">TestSonConcreteClass<\/span> : <span class=\"cm-variable\">TestConcreteClass<\/span>, <span class=\"cm-variable\">ITestInterface<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">new<\/span> <span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">SealTest<\/span>() { <span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Child Test\"<\/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\">\u7236\u985e\u8072\u660e\u7236\u985e\u5be6\u73fe<\/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-variable\">TestConcreteClass<\/span> <span class=\"cm-variable\">c<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">TestConcreteClass<\/span>();<\/span><br \/><span role=\"presentation\"><span class=\"cm-variable\">c<\/span>.<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Base Test<\/span><\/span><br \/><span role=\"presentation\">((<span class=\"cm-variable\">ITestInterface<\/span>)<span class=\"cm-variable\">c<\/span>).<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Base Test<\/span><\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">c\u7684\u985e\u578b\u5c0d\u8c61\u70ba\u7236\u985e\uff0c\u56e0\u6b64SealTest\u7684\u5be6\u73fe\u985e\u578b\u4e5f\u662f\u7236\u985e\uff0c\u8f38\u51fa\u4e5f\u70ba\u7236\u985e\u5be6\u73fe\u8f38\u51fa<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\"> \u5b50\u985e\u8072\u660e\u5b50\u985e\u5be6\u73fe<\/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-variable\">TestSonConcreteClass<\/span> <span class=\"cm-variable\">sc<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">TestSonConcreteClass<\/span>();<\/span><br \/><span role=\"presentation\"><span class=\"cm-variable\">sc<\/span>.<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Child Test<\/span><\/span><br \/><span role=\"presentation\">((<span class=\"cm-variable\">ITestInterface<\/span>)<span class=\"cm-variable\">sc<\/span>).<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Child Test<\/span><\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">sc\u7684\u985e\u578b\u5c0d\u8c61\u70ba\u5b50\u985e\uff0c\u56e0\u6b64SealTest\u7684\u5be6\u73fe\u985e\u578b\u4e5f\u662f\u5b50\u985e\uff0c\u8f38\u51fa\u4e5f\u70ba\u5b50\u985e\u5be6\u73fe\u8f38\u51fa<\/span><\/p><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u7236\u985e\u8072\u660e\u5b50\u985e\u5be6\u73fe<\/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-variable\">TestConcreteClass c<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">TestSonConcreteClass<\/span>();<\/span><br \/><span role=\"presentation\"><span class=\"cm-variable\">c<\/span>.<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Base Test<\/span><\/span><br \/><span role=\"presentation\">((<span class=\"cm-variable\">ITestInterface<\/span>)<span class=\"cm-variable\">c<\/span>).<span class=\"cm-variable\">SealTest<\/span>(); <span class=\"cm-comment\">\/\/Child Test<\/span><\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">c\u7684\u8072\u660e\u70ba\u7236\u985e\uff0c\u4e26\u4ee5\u5b50\u985e\u5be6\u4f8b\u5316<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u7531\u65bc\u662f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4ee5\u7236\u985e\u8072\u660e\uff0c\u56e0\u6b64\u76f4\u63a5\u8abf\u7528c.SealTest\u7684\u8a71\uff0c\u5c07\u6703\u8abf\u7528\u8a72\u300c\u7236\u985e\u300d\u4e2d\u7684\u5be6\u73fe<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5982\u679c\u5c07\u5176<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u5f37\u8f49\u70baITestInterface\uff0c\u7531\u65bc\u5be6\u73fe\u63a5\u53e3\u65b9\u6cd5\u7684\u5c0d\u8c61\u985e\u578b\u662f\u5b50\u985e\uff0c\u56e0\u6b64\uff0c\u8abf\u7528\u7684\u662f\u300c\u5b50\u985e\u300d\u7684\u5be6\u73fe<\/span><\/span><\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item md-focus-container\"><p class=\"md-end-block md-p\"><span class=\"md-plain md-expand\">\u628a\u985e\u5f37\u8f49\u6210\u63a5\u53e3\u985e\u578b\u5f8c\uff0c\u5c31\u53ea\u80fd\u8abf\u7528\u63a5\u53e3\u5b9a\u7fa9\u7684\u65b9\u6cd5<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u7531\u65bc\u6240\u6709\u985e\u578b\u90fd\u7e7c\u627f\u81eaObject\uff0c\u63a5\u53e3\u4e5f\u4e0d\u4f8b\u5916\uff0c\u6240\u4ee5\u63a5\u53e3\u5b9a\u7fa9\u7684\u65b9\u6cd5\u4e5f\u5305\u542b\u4e86Object\u4e0b\u7684\u4e00\u7cfb\u5217\u65b9\u6cd5\uff0c\u5982GetString\u3001GetHashCode\u7b49<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u7531\u65bc<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u63a5\u53e3\u8b8a\u91cf\u70ba\u5f15\u7528\u985e\u578b\uff0c\u56e0\u6b64\uff0c\u503c\u985e\u578b\u5f37\u8f49\u6210\u63a5\u53e3\u985e\u578b\u6642\u5fc5\u9808\u88dd\u7bb1<\/span><\/span><\/span><span class=\"md-plain\">\u3002\u4f7fCLR\u80fd\u6aa2\u67e5\u5c0d\u8c61\u7684\u985e\u578b\u5c0d\u8c61\u6307\u91dd\uff0c\u5f9e\u800c\u5224\u65b7\u5c0d\u8c61\u7684\u78ba\u5207\u985e\u578b<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u8abf\u7528\u5df2\u88dd\u7bb1\u503c\u985e\u578b\u7684\u63a5\u53e3\u65b9\u6cd5\u6642\uff0cCLR\u6703\u8ddf\u96a8\u5c0d\u8c61\u7684\u985e\u578b\u5c0d\u8c61\u6307\u91dd\u627e\u5230\u985e\u578b\u5c0d\u8c61\u7684\u65b9\u6cd5\u8868\uff0c\u5f9e\u800c\u8abf\u7528\u6b63\u78ba\u7684\u65b9\u6cd5<\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/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-7f66964 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7f66964\" 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-615a62b\" data-id=\"615a62b\" 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-81e50bc elementor-widget elementor-widget-text-editor\" data-id=\"81e50bc\" 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\">\u96b1\u5f0f\u63a5\u53e3\u65b9\u6cd5\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\">\u985e\u578b\u52a0\u8f09\u5230CLR\u6642\uff0c\u70ba\u8a72\u985e\u578b\u5275\u5efa\u4e00\u500b\u5167\u90e8\u6578\u64da\u7d50\u69cb\uff0c\u9019\u500b\u5167\u90e8\u6578\u64da\u7d50\u69cb\u4e2d\u5305\u542b\u4e86\u5176\u5b9a\u7fa9\u7684\u6240\u6709\u65b9\u6cd5\u7684\u6307\u91dd<\/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-605b980 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"605b980\" 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-f46df62\" data-id=\"f46df62\" 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-7d61458 elementor-widget elementor-widget-image\" data-id=\"7d61458\" 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=\"980\" height=\"790\" src=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_1_12.png\" class=\"attachment-large size-large wp-image-2061\" alt=\"\" srcset=\"https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_1_12.png 980w, https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_1_12-300x242.png 300w, https:\/\/lonelinerd.com\/wp-content\/uploads\/2022\/03\/CLR_1_12-768x619.png 768w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/>\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-8ffd94f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8ffd94f\" 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-6771732\" data-id=\"6771732\" 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-0be88c7 elementor-widget elementor-widget-text-editor\" data-id=\"0be88c7\" 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\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u985e\u578b\u5f15\u5165\u7684\u6bcf\u500b\u65b9\u6cd5\u90fd\u6709\u5c0d\u61c9\u7684\u8a18\u9304\u9805\uff0c\u5305\u62ec\u8a72\u985e\u578b\u7e7c\u627f\u7684\u6240\u6709\u865b\u65b9\u6cd5<\/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-plain\">\u9019\u4e9b\u865b\u65b9\u6cd5\u9664\u4e86\u57fa\u985e\u5b9a\u7fa9\u7684\u65b9\u6cd5\u5916\uff0c\u9084\u5305\u542b\u4e86\u63a5\u53e3\u5b9a\u7fa9\u7684\u65b9\u6cd5<\/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\">internal<\/span> <span class=\"cm-keyword\">sealed<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">SimpleType<\/span> : <span class=\"cm-variable\">IDisposable<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Dispose<\/span>() { <span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Dispose\"<\/span>); }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">SimpleType\u7684\u65b9\u6cd5\u8868\u5c07\u6703\u5305\u542b\u4ee5\u4e0b\u65b9\u6cd5\u7684\u8a18\u9304\u9805<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">Object\uff08\u96b1\u5f0f\u7e7c\u627f\u7684\u57fa\u985e\uff09\u5b9a\u7fa9\u7684\u6240\u6709\u865b\u5be6\u4f8b\u65b9\u6cd5<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">IDisposable\uff08\u7e7c\u627f\u7684\u63a5\u53e3\uff09\u5b9a\u7fa9\u7684\u6240\u6709\u63a5\u53e3\u65b9\u6cd5<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">SimpleType\u81ea\u5df1\u5b9a\u7fa9\u7684Dispose\u65b9\u6cd5<\/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-plain\">\u7576\u63a5\u53e3\u65b9\u6cd5\u7c3d\u540d\u548c\u65b0\u5f15\u5165\u7684\u65b9\u6cd5\u7684\u7c3d\u540d\u4e00\u81f4\uff08\u53c3\u6578\u548c\u8fd4\u56de\u985e\u578b\u4e00\u81f4\uff09\uff1a<\/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-plain\">C#\u7de8\u8b6f\u5668\u5047\u5b9aSimpleType\u81ea\u5df1\u5b9a\u7fa9\u7684Dispose\u65b9\u6cd5\u662f\u5c0dIDisposable\u7684Dispose\u65b9\u6cd5\u7684\u5be6\u73fe<\/span><\/span><\/span><\/p><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/li><\/ul><h5 class=\"md-end-block md-heading\"><strong><span class=\"md-plain\">\u986f\u5f0f\u63a5\u53e3\u65b9\u6cd5\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\">\u9664\u4e86\u76f4\u63a5\u5b9a\u7fa9\u4e00\u500b\u8207\u63a5\u53e3\u65b9\u6cd5\u540c\u6a23\u7c3d\u540d\u7684\u65b9\u6cd5\u4f86\u5be6\u73fe\u63a5\u53e3\u65b9\u6cd5\u5916\uff0c\u9084\u53ef\u4ee5<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u76f4\u63a5\u4ee5\u63a5\u53e3\u540d\u4f5c\u70ba\u65b9\u6cd5\u540d\u524d\u7db4\u4f86\u300c\u986f\u5f0f\u5be6\u73fe\u63a5\u53e3\u65b9\u6cd5\u300d\uff08EIMI\uff0cExplicit Interface Method Implementation\uff09<\/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\">internal<\/span> <span class=\"cm-keyword\">sealed<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">SimpleType<\/span> : <span class=\"cm-variable\">IDisposable<\/span><\/span><br \/><span role=\"presentation\">{ \u00a0 \u00a0 \u00a0 \u00a0<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/SimpleType\u5c0d\u8c61\u7684Dispose\u65b9\u6cd5<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Dispose<\/span>() { <span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"SimpleType Dispose\"<\/span>); }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/\u986f\u5f0f\u5be6\u73fe\u7684\u63a5\u53e3\u65b9\u6cd5Dispose<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">IDisposable<\/span>.<span class=\"cm-variable\">Dispose<\/span>() { <span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"IDisposable Dispose\"<\/span>); }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u986f\u5f0f\u5be6\u73fe\u7684\u63a5\u53e3\u65b9\u6cd5<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4e0d\u80fd\u5b9a\u7fa9\u8a2a\u554f\u4fee\u98fe\u7b26\uff0c\u4e14\u9ed8\u8a8d\u70baPrivate\u548cSealed\u7684\uff0c\u53ea\u80fd\u901a\u904e\u63a5\u53e3\u985e\u578b\u8b8a\u91cf\u53bb\u8abf\u7528\u8a72\u65b9\u6cd5\uff0c\u800c\u4e14\u4e0d\u80fd\u88ab\u91cd\u5beb<\/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=\"\" spellcheck=\"false\"><span role=\"presentation\">Method #2 (06000010) <\/span><br \/><span role=\"presentation\">-------------------------------------------------------<\/span><br \/><span role=\"presentation\">MethodName: System.IDisposable.Dispose (06000010)<\/span><br \/><span role=\"presentation\">Flags \u00a0 \u00a0 : [Private] [Final] [Virtual] [HideBySig] [NewSlot]  (000001e1)<\/span><br \/><span role=\"presentation\">RVA \u00a0 \u00a0 \u00a0 : 0x0000212e<\/span><br \/><span role=\"presentation\">ImplFlags : [IL] [Managed]  (00000000)<\/span><br \/><span role=\"presentation\">CallCnvntn: [DEFAULT]<\/span><br \/><span role=\"presentation\">hasThis <\/span><br \/><span role=\"presentation\">ReturnType: Void<\/span><br \/><span role=\"presentation\">No arguments.<\/span><\/pre><\/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-variable\">SimpleType<\/span> <span class=\"cm-variable\">st<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">SimpleType<\/span>();<\/span><br \/><span role=\"presentation\"><span class=\"cm-variable\">st<\/span>.<span class=\"cm-variable\">Dispose<\/span>(); <span class=\"cm-comment\">\/\/Output: SimpleType Dispose<\/span><\/span><br \/><span role=\"presentation\">((<span class=\"cm-variable\">IDisposable<\/span>)<span class=\"cm-variable\">st<\/span>).<span class=\"cm-variable\">Dispose<\/span>(); <span class=\"cm-comment\">\/\/Output: IDisposable Dispose<\/span><\/span><\/pre><\/li><\/ul><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5982\u679c<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u5be6\u73fe\u591a\u500b\u63a5\u53e3\u6642\uff0c\u9019\u4e9b\u63a5\u53e3\u4e4b\u9593\u5b58\u5728\u4e00\u500b\u7c3d\u540d\u548c\u65b9\u6cd5\u540d\u4e00\u6a23\u7684\u65b9\u6cd5\uff0c\u5be6\u73fe\u4ed6\u5011\u6642\uff0c\u5c31\u5fc5\u9808\u4f7f\u7528EIMI\u5be6\u73fe<\/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-plain\">\u8abf\u7528\u6642\u4e5f\u9808\u5148\u628a\u5c0d\u8c61\u8f49\u63db\u70ba\u6307\u5b9a\u7684\u63a5\u53e3\u985e\u578b\u624d\u80fd\u6b63\u78ba\u8abf\u7528\u9700\u8981\u7684\u63a5\u53e3\u65b9\u6cd5<\/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\">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\">Tester<\/span> <span class=\"cm-variable\">tt<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">Tester<\/span>();<\/span><br \/><span role=\"presentation\"> \u00a0  ((<span class=\"cm-variable\">ITestA<\/span>)<span class=\"cm-variable\">tt<\/span>).<span class=\"cm-variable\">Test<\/span>();<\/span><br \/><span role=\"presentation\"> \u00a0  ((<span class=\"cm-variable\">ITestB<\/span>)<span class=\"cm-variable\">tt<\/span>).<span class=\"cm-variable\">Test<\/span>();<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">interface<\/span> <span class=\"cm-def\">ITestA<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Test<\/span>();<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">interface<\/span> <span class=\"cm-def\">ITestB<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">Test<\/span>();<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">Tester<\/span> : <span class=\"cm-variable\">ITestA<\/span>, <span class=\"cm-variable\">ITestB<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">ITestA<\/span>.<span class=\"cm-variable\">Test<\/span>() { }<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">ITestB<\/span>.<span class=\"cm-variable\">Test<\/span>() { } \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-plain\">\u4f46\u662fEIMI\u5b58\u5728\u8f03\u591a\u7684\u4f7f\u7528\u96b1\u60a3\uff0c\u61c9<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u76e1\u53ef\u80fd\u4f7f\u7528\u6cdb\u578b\u63a5\u53e3\u53d6\u4ee3<\/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-plain\">\u6bd4\u5982\u8981\u628a\u5c0d\u8c61\u8f49\u63db\u6210\u6307\u5b9a\u63a5\u53e3\u985e\u578b\u624d\u80fd\u8abf\u7528\u5c0d\u61c9\u7684\u63a5\u53e3\u65b9\u6cd5\uff0c\u5fc5\u9808\u4f7f\u503c\u985e\u578b\u5c0d\u8c61\u767c\u751f<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u88dd\u7bb1<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u53e6\u5916\uff0cEIMI<\/span><span class=\"md-html-inline\" spellcheck=\"false\"><span style=\"color: red;\"><span class=\"md-plain\">\u4e0d\u80fd\u7531\u6d3e\u751f\u985e\u8abf\u7528<\/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-plain\">EIMI\u65b9\u6cd5\u4e8b\u5be6\u4e0a\u4e0d\u662f\u985e\u578b\u7684\u5c0d\u8c61\u6a21\u578b\u7684\u4e00\u90e8\u5206<\/span><\/span><\/span><span class=\"md-plain\">\uff0c\u53ea\u662f\u5c07\u63a5\u53e3\u548c\u985e\u578b\u9023\u63a5\u8d77\u4f86\uff0c\u63d0\u4f9b\u4e86\u4e00\u500b\u7528\u63a5\u53e3\u985e\u578b\u8b8a\u91cf\u4f86\u8abf\u7528\u7684\u65b9\u6cd5<\/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\">class<\/span> <span class=\"cm-def\">CompareBase<\/span> : <span class=\"cm-variable\">IComparable<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">IComparable<\/span>.<span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable-3\">object<\/span> <span class=\"cm-variable\">obj<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Base Compare\"<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">return<\/span> <span class=\"cm-number\">0<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">public<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">CompareChild<\/span> : <span class=\"cm-variable\">CompareBase<\/span>, <span class=\"cm-variable\">IComparable<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable-3\">object<\/span> <span class=\"cm-variable\">o<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Console<\/span>.<span class=\"cm-variable\">WriteLine<\/span>(<span class=\"cm-string\">\"Child Compare\"<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-comment\">\/\/base.CompareTo(o); \/\/base\u4e0d\u5b58\u5728CompareTo\u65b9\u6cd5<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">return<\/span> <span class=\"cm-number\">0<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/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-4d3fbef elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4d3fbef\" 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-6433d04\" data-id=\"6433d04\" 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-3b8b370 elementor-widget elementor-widget-text-editor\" data-id=\"3b8b370\" 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\">\u6cdb\u578b\u63a5\u53e3<\/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\">\u597d\u8655\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\">\u63d0\u4f9b\u4e86\u7de8\u8b6f\u6642\u7684\u985e\u578b\u5b89\u5168\u6027<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6e1b\u5c11\u8655\u7406\u503c\u985e\u578b\u6642\u7684\u88dd\u7bb1\u6b21\u6578<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u6cdb\u578b\u63a5\u53e3\u53ef\u4ee5\u9650\u5236\u65b9\u6cd5\u671f\u5f85\u7684\u53c3\u6578\u985e\u578b\uff0c\u4f7f\u5f97\u65b9\u6cd5\u4e0d\u518d\u9700\u8981\u90fd\u671f\u5f85\u63a5\u6536\u4e00\u500bobject\u985e\u53c3\u6578\uff0c\u4e26\u5728\u50b3\u5165\u503c\u985e\u578b\u5be6\u53c3\u6642\u5c0e\u81f4\u88dd\u7bb1\u767c\u751f<\/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-plain\">\u4e00\u500b\u63a5\u53e3\u53ef\u4f7f\u7528\u4e0d\u540c\u7684\u985e\u578b\u53c3\u6578\u4f86\u88ab\u5be6\u73feN\u6b21<\/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\">public<\/span> <span class=\"cm-keyword\">sealed<\/span> <span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">Number<\/span> : <span class=\"cm-variable\">IComparable<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable-3\">int<\/span><span class=\"cm-operator\">&gt;<\/span>, <span class=\"cm-variable\">IComparable<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable-3\">string<\/span><span class=\"cm-operator\">&gt;<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">n<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-number\">5<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">other<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">return<\/span> <span class=\"cm-variable\">n<\/span>.<span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable\">other<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-keyword\">public<\/span> <span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable-3\">string<\/span> <span class=\"cm-variable\">other<\/span>)<\/span><br \/><span role=\"presentation\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-keyword\">return<\/span> <span class=\"cm-variable\">n<\/span>.<span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-variable-3\">int<\/span>.<span class=\"cm-variable\">Parse<\/span>(<span class=\"cm-variable\">other<\/span>));<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/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=\"C#\" spellcheck=\"false\"><span role=\"presentation\"><span class=\"cm-keyword\">class<\/span> <span class=\"cm-def\">Program<\/span><\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<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\"> \u00a0  {<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0 \u00a0<span class=\"cm-variable\">Number<\/span> <span class=\"cm-variable\">n<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable\">Number<\/span>();<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0  ((<span class=\"cm-variable\">IComparable<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable-3\">int<\/span><span class=\"cm-operator\">&gt;<\/span>)<span class=\"cm-variable\">n<\/span>).<span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-number\">10<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0 \u00a0  ((<span class=\"cm-variable\">IComparable<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable-3\">string<\/span><span class=\"cm-operator\">&gt;<\/span>)<span class=\"cm-variable\">n<\/span>).<span class=\"cm-variable\">CompareTo<\/span>(<span class=\"cm-string\">\"10\"<\/span>);<\/span><br \/><span role=\"presentation\"> \u00a0  }<\/span><br \/><span role=\"presentation\">}<\/span><\/pre><\/li><\/ul><\/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-f7d40b2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f7d40b2\" 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-68f4dd4\" data-id=\"68f4dd4\" 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-b15b2cd elementor-widget elementor-widget-text-editor\" data-id=\"b15b2cd\" 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 md-focus\"><strong><span class=\"md-plain\">\u63a5\u53e3\u7d04\u675f<\/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\">\u6cdb\u578b\u985e\u578b\u53c3\u6578\u53ef\u88ab\u7d04\u675f\u70ba\u63a5\u53e3\uff0c\u9650\u5236\u50b3\u905e\u7684\u53c3\u6578\u985e\u578b\u5fc5\u9808\u5be6\u73fe\u5168\u90e8\u63a5\u53e3\u7d04\u675f<\/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\">void<\/span> <span class=\"cm-variable\">Test<\/span>()<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">x<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-number\">5<\/span>; <span class=\"cm-comment\">\/\/Int Implemented IComparable and IConvertible<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable-3\">Guid<\/span> <span class=\"cm-variable\">g<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-keyword\">new<\/span> <span class=\"cm-variable-3\">Guid<\/span>(); <span class=\"cm-comment\">\/\/Guid Doesn't Implement IComparable but not IConvertible<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">M<\/span>(<span class=\"cm-variable\">x<\/span>); <span class=\"cm-comment\">\/\/Compile Success<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/M(g); \/\/Compile Failed<\/span><\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\">\u200b<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">M<\/span><span class=\"cm-operator\">&lt;<\/span><span class=\"cm-variable\">T<\/span><span class=\"cm-operator\">&gt;<\/span>(<span class=\"cm-variable\">T<\/span> <span class=\"cm-variable\">t<\/span>) <span class=\"cm-variable\">where<\/span> <span class=\"cm-variable\">T<\/span> : <span class=\"cm-variable\">IComparable<\/span>, <span class=\"cm-variable\">IConvertible<\/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-plain\">\u5982\u679c\u6cdb\u578b\u985e\u578b\u53c3\u6578\u88ab\u7d04\u675f\u70ba\u63a5\u53e3\uff0c\u985e\u578b\u5be6\u53c3\u5be6\u969b\u4e0a\u53ef\u4ee5\u662f\u4efb\u610f\u985e\u578b\uff0c\u53ea\u8981\u8a72\u985e\u578b\u5be6\u73fe\u4e86\u7d04\u675f\u6240\u9700\u7684\u63a5\u53e3\u5373\u53ef<\/span><\/span><\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u53e6\u5916\uff0c\u63a5\u53e3\u7d04\u675f\u4e5f\u80fd\u6e1b\u5c11\u50b3\u905e\u503c\u985e\u578b\u7684\u5be6\u4f8b\u6642\u767c\u751f\u7684\u88dd\u7bb1<\/span><\/p><ul class=\"ul-list\" data-mark=\"-\"><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u5982\u679c\u65b9\u6cd5\u5b9a\u7fa9\u70ba\u9019\u6a23\uff0c\u5c31\u6703\u56e0\u70ba\u503c\u985e\u578b\u9700\u8981\u88ab\u8f49\u63db\u70ba\u63a5\u53e3\u985e\u578b\u800c\u767c\u751f\u88dd\u7bb1<\/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\">void<\/span> <span class=\"cm-variable\">Test<\/span>()<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable-3\">int<\/span> <span class=\"cm-variable\">x<\/span> <span class=\"cm-operator\">=<\/span> <span class=\"cm-number\">5<\/span>;<\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-comment\">\/\/...<\/span><\/span><br \/><span role=\"presentation\"> \u00a0 \u00a0<span class=\"cm-variable\">N<\/span>(<span class=\"cm-variable\">x<\/span>)<\/span><br \/><span role=\"presentation\">}<\/span><br \/><span role=\"presentation\"><span class=\"cm-keyword\">void<\/span> <span class=\"cm-variable\">N<\/span>(<span class=\"cm-variable\">IComparable<\/span> <span class=\"cm-variable\">t<\/span>) { } <span class=\"cm-comment\">\/\/Need Box<\/span><\/span><\/pre><\/li><\/ul><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">C#\u7de8\u8b6f\u5668\u70ba\u63a5\u53e3\u7d04\u675f\u751f\u6210\u7279\u6b8aIL\u6307\u4ee4\uff0c\u5c0e\u81f4\u76f4\u63a5\u5728\u503c\u985e\u578b\u4e0a\u8abf\u7528\u63a5\u53e3\u65b9\u6cd5\u800c\u4e0d\u88dd\u7bb1<\/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 private hidebysig static void  Test() cil managed<\/span><br \/><span role=\"presentation\">{<\/span><br \/><span role=\"presentation\">\/\/...<\/span><br \/><span role=\"presentation\">  IL_000b:  ldloc.0<\/span><br \/><span role=\"presentation\">  IL_000c:  call \u00a0 \u00a0 \u00a0 void CLR_Ch13.Program::M&lt;int32&gt;(!!0)<\/span><br \/><span role=\"presentation\">  IL_0011:  nop<\/span><br \/><span role=\"presentation\">  IL_0012:  ldloc.0<\/span><br \/><span role=\"presentation\">  IL_0013:  box \u00a0 \u00a0 \u00a0  [System.Runtime]System.Int32<\/span><br \/><span role=\"presentation\">  IL_0018:  call \u00a0 \u00a0 \u00a0 void CLR_Ch13.Program::N(class [System.Runtime]System.IComparable)<\/span><br \/><span role=\"presentation\">  IL_001d:  nop<\/span><br \/><span role=\"presentation\">  IL_001e:  ret<\/span><br \/><span role=\"presentation\">} \/\/ end of method Program::Test<\/span><\/pre><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u4e0d\u7528\u63a5\u53e3\u7d04\u675f\u4fbf\u6c92\u6709\u5176\u4ed6\u8fa6\u6cd5\u8b93C#\u7de8\u8b6f\u5668\u751f\u6210\u9019\u4e9bIL\u6307\u4ee4\uff0c\u5982\u6b64\u4e00\u4f86\uff0c\u5728\u503c\u985e\u578b\u4e0a\u8abf\u7528\u63a5\u53e3\u65b9\u6cd5\u7e3d\u662f\u767c\u751f\u88dd\u7bb1<\/span><\/p><\/li><li class=\"md-list-item\"><p class=\"md-end-block md-p\"><span class=\"md-plain\">\u9664\u975e\u662f\u5728\u503c\u985e\u578b\u5be6\u73fe\u4e86\u4e00\u500b\u63a5\u53e3\u65b9\u6cd5\uff0c\u5728\u8a72\u5be6\u4f8b\u4e0a\u8abf\u7528\u9019\u500b\u65b9\u6cd5\u5c31\u4e0d\u6703\u767c\u751f\u88dd\u7bb1<\/span><\/p><\/li><\/ul><\/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-e761968 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e761968\" 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-07b80a2\" data-id=\"07b80a2\" 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-1e1af70 elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"1e1af70\" 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-a4a3f1d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a4a3f1d\" 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-f91b187\" data-id=\"f91b187\" 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-59a031b elementor-widget elementor-widget-text-editor\" data-id=\"59a031b\" 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>\u63a5\u53e3\u53ef\u4ee5\u5b9a\u7fa9\u5927\u90e8\u5206\u65b9\u6cd5\u3001\u4ee5\u53ca\u4e8b\u4ef6\u3001\u5c6c\u6027\uff0c\u4f46\u4e0d\u80fd\u5b9a\u7fa9\u69cb\u9020\u5668\u65b9\u6cd5\u3001\u5be6\u4f8b\u5b57\u6bb5\u548c\u975c\u614b\u6210\u54e1\u3002\u5728CLR\u770b\u4f86\uff0c\u63a5\u53e3\u5b9a\u7fa9\u5c31\u662f\u985e\u578b\u5b9a\u7fa9\uff0c\u6240\u4ee5\uff0cCLR\u6703\u70ba\u63a5\u53e3\u985e\u578b\u5c0d\u8c61\u5b9a\u7fa9\u300c\u5167\u90e8\u6578\u64da\u7d50\u69cb\u300d\uff1b\u540c\u6642\u4e5f\u53ef\u4ee5\u901a\u904e\u53cd\u5c04\u6a5f\u5236\u4f86\u67e5\u8a62\u63a5\u53e3\u985e\u578b\u7684\u529f\u80fd<\/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-3721","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\/3721","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=3721"}],"version-history":[{"count":6,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts\/3721\/revisions"}],"predecessor-version":[{"id":3729,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/posts\/3721\/revisions\/3729"}],"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=3721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/categories?post=3721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lonelinerd.com\/index.php\/wp-json\/wp\/v2\/tags?post=3721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}