因此,在使用C#开发我的软件时,我对刚刚发生的错误感到困惑。无法弄清楚哪些是错的,因为所有这些都是公开的,不应该是问题?
完整错误是:
错误1可访问性不一致:字段类型 ' TextbasedGameEngine.DataStorage.TBGE_FilePaths'不太容易接近 比田野 ' TextbasedGameEngine.GameDesignerForm.FilePaths' C:\用户\凯文\文档\ Visual 工作室 2013 \ Projects \ TextbasedGameEngine \ TextbasedGameEngine \ Form1.cs 24 31 TextbasedGameEngine
我有主要课程" GameDesignerForm "如下:
...
using TextbasedGameEngine.DataStorage;
using TextbasedGameEngine.Handlers;
namespace TextbasedGameEngine {
public partial class GameDesignerForm : Form {
private TreeNodeMouseClickEventArgs CurrentSelectedSequence;
private TreeNodeMouseClickEventArgs CurrentSelectedChoice;
public static GameDesignerForm instance;
public TBGE_FilePaths FilePaths;
public GameDesignerForm() {
InitializeComponent();
}
private void GameDesignerForm_Load(object sender, EventArgs e) {
FilePaths = new TBGE_FilePaths(Application.StartupPath);
instance = this;
ReloadSave();
}
}
}
我尝试访问/使用的课程是 TBGE_FilePaths 在另一个文件夹中:
...
using TextbasedGameEngine.Handlers;
namespace TextbasedGameEngine.DataStorage {
class TBGE_FilePaths {
public string STARTUP_PATH;
public string LOCATION_PATH;
public string PROJECT_NAME;
public string CURRENT_SAVE_FILE = "/TBGE_Data/current_save.txt";
public string SEQUENCE_SAVE_FILE;
public string CHOICE_SAVE_FILE;
public TBGE_FilePaths(string startupPath) {
//Constructor
STARTUP_PATH = startupPath;
PROJECT_NAME = TBGE_FileHandler.GetCurrentSaveFile(STARTUP_PATH + CURRENT_SAVE_FILE);
LOCATION_PATH = STARTUP_PATH + "/TBGE_Data/SaveFiles/" + PROJECT_NAME + "/";
SEQUENCE_SAVE_FILE = LOCATION_PATH + "Sequences.xml";
CHOICE_SAVE_FILE = LOCATION_PATH + "Choices.xml";
}
}
}
答案 0 :(得分:1)
您需要TBGE_FilePaths
班公开,默认情况下班级为internal
。
public class TBGE_FilePaths