小编Fra*_*tel的帖子

为什么string []被识别为字符串

我正在尝试将我的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)

c# xml class-structure winforms

-4
推荐指数
1
解决办法
146
查看次数

标签 统计

c# ×1

class-structure ×1

winforms ×1

xml ×1