为什么我的显示在将 double 解析为字符串时冻结

Why does my display freezes when parsing double to a String

嘿,我总是想比较列表中的前两个元素(双),所以这是我的代码:

            String allMarks = "";
            String toString1 = "";
            String toString2 = "";

            if (eventcounter.Count > 1)
            {
                allMarks = allMarks + eventcounter[0];

                for (int i = 0; i < eventcounter.Count; i++)
                {
                    toString1 = eventcounter[i].ToString();

                    for (int j = 1; j <= eventcounter.Count; i++)
                    {
                        toString2 = eventcounter[j].ToString();

                        if (toString1 != toString2)//(eventcounter[i] != eventcounter[j])
                        {
                            allMarks = allMarks + eventcounter[j];
                            Console.WriteLine(allMarks);

                        }
                    }
                }

            }

我真的不明白为什么我的 Eventcounter 不会显示在我的应用程序上。

04-03 19:14:09.326 D/InputTransport(29861): 构建的输入通道:fd=71 04-03 19:14:09.330 V/InputMethodManager(29861):起始输入:tba=android.view.inputmethod.EditorInfo@1c5db21 nm:accelerometer2.accelerometer2 ic=null 04-03 19:14:09.658 I/art (29861): 显式启动阻塞 GC 04-03 19:14:09.675 I/art (29861):显式并发标记扫描 GC 释放了 18697(999KB) 个 AllocSpace 对象,0(0B) 个 LOS 对象,39% 空闲,9MB/15MB,暂停 123us 总计17.306 毫秒 04-03 19:14:09.676 D/Mono (29861): GC_TAR_BRIDGE 桥接 3 个对象 4 不透明 1 颜色 3 颜色桥接 3 颜色可见 3 外部参照 0 缓存命中 0 缓存半命中 0缓存未命中 0 设置 0.02ms tarjan 0.00ms scc-setup 0.02ms gather-xref 0.00ms xref-setup 0.01ms cleanup 0.03ms 04-03 19:14:09.676 D/Mono (29861):GC_BRIDGE:完成,运行 持续 17.88 毫秒 04-03 19:14:09.676 D/Mono (29861): GC_MINOR: (Nursery full) time 1.11ms, stw 1.46ms promoted 73K major size: 784K in use: 122K los size: 0K使用中:0K 04-03 19:14:09.959 D/Mono (29861): GC_TAR_BRIDGE 桥接 0 个对象 0 不透明 0 颜色 0 颜色桥接 0 颜色可见 3 外部参照 0 缓存命中 0 缓存半命中 0缓存未命中 0 设置 0.02ms tarjan 0.00ms scc-setup 0.02ms gather-xref 0.00ms xref-setup 0.01ms cleanup 0.00ms 04-03 19:14:09.959 D/Mono (29861):GC_BRIDGE:完成,运行 0.07 毫秒

看起来像一个无限循环,因为你的第二个 for 循环递增 i 而不是 j