【问题标题】:Code auto-complete does not work for one specific class代码自动完成不适用于一个特定的类
【发布时间】:2014-06-04 05:33:59
【问题描述】:

正如标题所说,我的代码没有在我的项目中的一个特定类中自动完成,这对于像我这样的初学者来说真的很糟糕。

我已经尝试了 Ctrl + Alt + Space 并转到工具 -> 文本编辑器 -> C# -> IntelliSense。此处勾选了“输入字符后显示完成列表”。

注意:Ctrl + Alt + Space 可以在其他类中使用,如果有帮助的话。

相关代码为:

namespace AudioDevices.Devices
{
    class CdDiscMan : DisplayAudioDevice
    {
        private readonly int mBSize = 700;
        private bool isEjected = false;

        public CdDiscMan(int serialId)
        {
            base.SerialID = serialId;
        }

        public void Eject()
        {
            isEjected = !isEjected;
        }

        public int MbSize
        {
            get { return mBSize; }
        }
        public bool IsEjected
        {
           get { return isEjected; }
        }
    }
}

根据要求,自动完成仍然起作用的类:

namespace AudioDevices
{

public class Track
{
    private category style;
    private int id;
    private string name, artist, albumSource;
    private Time length;


    public Track()
    {

    }
    public Track(int id)
    {
        this.id = id;
    }
    public Track(int id, string name)
    {
        this.id = id;
        this.name = name;
    }
    public Track(int id, string artist, string name)
    {
        this.id = id;
        this.artist = artist;
        this.name = name;
    }

    public string GetLength()
    {
        return length.ToString();

    }
    public int GetLengthInSeconds()
    {
        return length.Seconds +
            (length.Minutes * 60) +
            (length.Hours * 3600);
    }
}
}

【问题讨论】:

  • 添加另一个(小)类的代码,其中智能工作正常。同时提及两者的文件名。希望你会得到答复。另外.. 它是ctrl+space... 不是ctrl+alt+space 需要
  • 我希望你已经从这个线程检查过stackoverflow的答案。google.com.pk/#q=intellisense+not+working+in+visual+studio

标签: visual-studio ide visual-studio-2013 intellisense


【解决方案1】:

确保两个类的命名空间相同。如果是,则重新启动(退出/启动)Visual Studio...

【讨论】:

  • 重启VS解决了问题,谢谢!命名空间不是问题
【解决方案2】:

我认为您要么忘记在某处放置分号,要么在某处犯了语法错误。请发布您的代码,以便我可以告诉您问题所在。

【讨论】:

猜你喜欢
  • 2019-11-05
  • 1970-01-01
  • 1970-01-01
  • 2012-05-02
  • 1970-01-01
  • 1970-01-01
  • 2022-01-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多