我正在尝试实例化我的“边界”类,但是当我在主类中键入该类时却没有显示。但是,我将类添加到过去的项目中,并且一切正常,因此它与我的代码无关。我是C#的新手,想知道是否对此有一个简单的解决方法。
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game1
{
class Boundries
{
public int boundY, boundX, boundWidth, boundLength;
public Boundries(Rectangle bRectangle, int intX, int intY, int intWidth, int intLength)
{
boundY = intY;
boundX = intX;
boundWidth = intWidth;
boundLength = intLength;
}
}
}
该课程在我过去的项目中工作得很好,但在我的新项目中却没有。
直接在名称空间内声明的类和结构(在其他名称空间中不嵌套在其他类或结构中的单词)可以是公开或内部的。如果没有访问权限,则内部为默认设置指定了修饰符。
您不能在其他项目中实例化它,因为您没有在课程中添加“ public”。
public class Boundries
{
}