可访问性不一致:TBGE_FilePaths的可访问性低于字段FilePaths
本文关键字:FilePaths 访问 字段 于字段 TBGE 不一致 | 更新日期: 2023-09-27 17:57:55
所以在用C#开发软件时,我被刚刚发生的这个错误难住了。不知道出了什么问题,因为所有这些都是公开的,这不应该是问题所在?
完整错误为:
错误1可访问性不一致:字段类型'基于文本的游戏引擎。数据存储。TBGE_FilePaths的可访问性较低比字段'基于文本的游戏引擎。GameDesignerForm。FilePaths的C:''Users''Kevin''documents''visual演播室2013''Projects''TextbasedGameEngine''TextbasedGameEngine ''Form1.cs 24 31基于文本的游戏引擎
我有如下的主类"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";
}
}
}
您需要将TBGE_FilePaths
类设置为公共,默认情况下类为internal
。
public class TBGE_FilePaths