我知道这个问题以前在这里问过,但我找不到我的代码有什么问题。
class Slider
{
public int const DEFAULT_SIZE = 20; // Problem is here. Invalid token in class
private int rise { get; set; }
private int run { get; set; }
private int size { get; set; }
int positionX = 0;
int positionY = 0;
private int leftBoundX { get; set;}
private int leftBoundY { get; set; }
private int rightBoundX { get; set; }
private int rightBoundY { get; set; }
// Constructor
Slider()
{
size = DEFAULT_SIZE;
}
private void Bound()
{
if (positionX > leftBoundX)
positionX = rightBoundX;
else if (positionY > leftBoundY)
positionY = rightBoundY;
else if (positionX > leftBoundX)
positionX = rightBoundX;
else if (positionX > leftBoundX)
positionX = rightBoundX;
}
我用谷歌搜索了一些东西,他们告诉我要包括 System.Collection 我做了但仍然是同样的错误