所以我有一个板用户控制
public partial class BoardController : UserControl
{
List<HotSpot> _hotSpots;
List<Area> _areas;
public BoardController()
{
InitializeComponent();
InitializeHitSpots();
InitializePlacementArrays();
}...
还有一个游戏控制器
public class GameController
{
private BoardController _board;
private List<PlayerController> _players;
public GameController()
{
_board = new BoardController();
_players = new List<PlayerController>();
}
public BoardController Board
{
get
{
return _board;
}
}...
现在,即使我有一个公共属性 Board,如果我将 BoardController 类设为内部,我也会在下一行抛出一个错误
private void Form1_Load(object sender, EventArgs e)
{
game = new GameController();
this.Controls.Add(game.Board); //<-- this line
}
.
Error: GameController.Board' is inaccessible due to its protection level
什么是正确的类修饰符声明,以便同一程序集中的类可以使用 BoardController,但其他程序集不能创建 BoardController 对象,也不能在程序集之外修改 BoardController?