在C#中,我有一项可收回的职能,即想篡改一个全球性的变量(即假定它属于全球范围,而此前它是由公众宣布的)。 由于某种原因,我不知道它无法看到这一具体职能中的公共变数。 它可以在我的法典中将其放在第一功能中,但不能在第二功能中看到它需要查阅和修改,以节省时间,打开档案文件。
是否有什么理由可以进入? 如果是的话,如何绕过它?
预言如此之多!
public int[] timeInfo = new int[2];
private void ListDirectory(TreeView treeView, string path)
{
treeView.Nodes.Clear();
var rootDirectoryInfo = new DirectoryInfo(path);
treeView.Nodes.Add(CreateDirectoryNode(rootDirectoryInfo));
}
private static TreeNode CreateDirectoryNode(DirectoryInfo directoryInfo)
{
var directoryNode = new TreeNode(directoryInfo.Name);
foreach (var directory in directoryInfo.GetDirectories())
directoryNode.Nodes.Add(CreateDirectoryNode(directory));
foreach (var file in directoryInfo.GetFiles())
{
int check =0;
try
{
string s = "";
s = directoryInfo.FullName + "\" + file.Name;
List<string> row, row2, row3 = new List<string>();
using (StreamReader readFile = new StreamReader(s))
{
row = (readFile.ReadLine().Split( , ).ToList());
try
{
row2 = (readFile.ReadLine().Split( , ).ToList());
//timeInfo[0] = row2[0];
}
catch { check = 1; }
try
{
row3 = (readFile.ReadLine().Split( , ).ToList());
//timeInfo[1] = row3[0];
}
catch { }
}
TreeNode[] headerNodes = new TreeNode[row.Count];
for (int i = 0; i < row.Count; i++)
{
headerNodes[i] = new TreeNode(row[i]);
if (check == 1)
{
headerNodes[i].BackColor = Color.Red;
headerNodes[i].ForeColor = Color.White;
}
}
directoryNode.Nodes.Add(new TreeNode(file.Name, headerNodes));
}
catch
{
directoryNode.Nodes.Add(new TreeNode(file.Name));
}
}
return directoryNode;
}