在本主题内连接: 如何将我的班级中的字符串连接到表格
我试图做与他们的答案相关的解决方案(特别是杰里米爵士的回答),但这个错误不断出现
“KeyWord.KeyWord.keywords”因其保护级别而无法访问
KeyWords.cs 的代码:
namespace KeyWord
{
public class KeyWord
{
String[] keywords = { "abstract", "as", "etc." };
}
}
main.cs 的代码
// Check whether the token is a keyword.
var keyboardCls = new KeyWord.KeyWord();
String[] keywords = keyboardCls.keywords;
for (int i = 0; i < keywords.Length; i++)
{
if (keywords[i] == token)
{
// Apply alternative color and font to highlight keyword.
rtb.SelectionColor = Color.Blue;
rtb.SelectionFont = new Font("Courier New", 10, FontStyle.Bold);
break;
}
}
我该怎么办?