Make sure your namespace is same for both classes.. If yes then restart (quit/start) the visual studio...
Code auto-complete does not work for one specific class
-
06-07-2023 - |
Question
Like the title says, my code isn't auto completing in one specific class in my project which is really terrible for a beginning programmer like me.
I've tried both Ctrl + Alt + Space and going to Tools -> Text Editor -> C# -> IntelliSense. Here "Show completion list after a character is typed" is checked.
Note: Ctrl + Alt + Space does work in other classes, if that is of any help.
The relevant code is:
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; }
}
}
}
Upon request, a class in which the auto-complete still functions:
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);
}
}
}
La solution
Autres conseils
I think you either have forgotten to put a semicolon somewhere or you have made a syntax error somewhere. Please post your code so that I can tell you whats the problem.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow