[已关闭问题]
现有接口<br><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span id="Codehighlighter1_31_121_Open_Text"></span><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">interface</span> ITreeNode<br><div class="cnblogs_code"><span style="color: rgb(0, 0, 0);">{<br> ITreeNode Parent { </span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">; }<br> ICollection</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">ITreeNode</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> Children { </span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);">; }<br>}<br></span></div></div><br>实现类<br><div class="cnblogs_code"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> Node : ITreeNode<br>{<br> List</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Node</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> nodes;<br> </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> ICollection</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">ITreeNode</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> Children<br> {<br> </span><span style="color: rgb(0, 0, 255);">get</span><span style="color: rgb(0, 0, 0);"> { </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> nodes; }<br> }<br>}</span></div>会出现编译错误。<br><br>无法使用<br><span style="color: rgb(0, 0, 0);">List</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">Node</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> nodes; => </span><span style="color: rgb(0, 0, 0);">List</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">ITreeNode</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> nodes;</span><br>如何解决?<br>