我正在尝试将我的XML类与Math类分开.我正在读一个xml文件,查找该人开始的时间并将其放入字符串[](我想??)
public static string elementStartWeek()
{
XmlDocument xmldoc = new XmlDocument();
fileExistsWeek(xmldoc);
XmlNodeList nodeStart = xmldoc.GetElementsByTagName("Start");
int count2 = 0;
string[] starttxtWeek = new string[count2];
for (int i = 0; i <= nodeStart.Count; i++)
{
starttxtWeek[count2] = nodeStart[i].InnerText;
count2++;
}
return starttxtWeek[count2];
}
Run Code Online (Sandbox Code Playgroud)
我想将数组带入我的Math类并将时间转换为十进制值进行计算.我的Math类似乎将其识别为字符串而不是数组.
public static void startHour()
{
string weekStart = WidgetLogic.elementStartWeek();
string startTime = "";
if (1 == 1)
{
startTime = weekStart;
MessageBox.Show(weekStart);
}
}
Run Code Online (Sandbox Code Playgroud)
我希望weekStart在Math.cs中抛出一个错误.为什么这不会引发错误?
我正在调用startHour()UI对话框DetailerReport
public DetailerReports()
{
InitializeComponent();
Math.startHour();
} …Run Code Online (Sandbox Code Playgroud)