界面代码生成.... Visual Studio 2015 中的快速操作和重构功能

Code Generation for interface....Quick Actions and Refactorings feature in Visual Studio 2015

Click here for demo of problem Visual Studio Community 2015 正在发生这种情况 版本 14.0.25431.01 更新 3 在 Framework 4.7

这本书是这么说的(John Sharp,Microsoft Visual Studio,循序渐进,第八版,第 427 页。)

"Return to the definition of the TreeEnumerator class. In the class declaration, hover over the text IEnumerator. On the drop-down context menu that appears (with a lightbulb icon)--(I assume he means after you right-click)--click Implement Interface Explicitly".

当我右键单击时,我没有看到 "implement interface explicitly",但我确实看到了 "Quick Actions Refactorings",因为另一个 link(我正在尝试查找)说这是正确的选项,我选择了它,但实际上没有任何反应......就像我什么也没做一样......

using System;



public class TreeEnumorator<TItem> : IEnumerator<TItem> where TItem : IComparable<TItem>
{
    private TreeEnumorator<TItem> currentData = null;
    private TItem currentItem = default(TItem);
    private Queue<TItem> enumData = null;

    //***** when dealing with a generic class, the constructor does not have <TYPE>
    //NOTICE the name of the constructor is not TreeEnumorator<TItem>
    public TreeEnumorator(Tree<TItem> data)
    {
        this.currentData = data;
    }

    private void populate(Queue<TItem> enumQueue, Tree<TItem> tree)
    {
        if (tree.LeftTree != null)
        {
            populate(enumQueue, tree.LeftTree);
        }

        enumQueue.Enqueu(tree.NodeData);

        if (tree.RightTree != null)
        {
            populate(enumQueue, tree.RightTree);
        }

    }

我创建的代码放在我的 Solution Items 文件夹中。 它没有放在我的项目文件夹中。 一旦我移动它,它就可以正常工作了...