首页 > 解决方案 > 为什么我的显示在将双精度解析为字符串时冻结

问题描述

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

            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);

                        }
                    }
                }

            }

我真的不明白为什么我的事件计数器不会显示在我的应用程序上。

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 objects, 0(0B) LOS objects, 39% free, 9MB/15MB, paused 123us total 17.306ms 04-03 19:14:09.676 D/Mono (29861): GC_TAR_BRIDGE bridges 3 objects 4 opaque 1 colours 3 颜色桥接 3 颜色可见 3 外部参照 0 缓存命中 0 缓存半命中 0 缓存未命中 0 设置 0.02 毫秒 tarjan 0.00 毫秒 scc 设置 0.02 毫秒聚集外部参照 0.00 毫秒外部参照设置 0.01 毫秒清理 0.03 毫秒 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) 时间 1.11ms, stw 1.46ms 提升 73K 主要尺寸: 784K 使用中: 122K los 尺寸: 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.02 毫秒 tarjan 0.00 毫秒 scc 设置 0.02 毫秒收集外部参照 0.00 ms xref-setup 0.01ms cleanup 0.00ms 04-03 19:14:09.959 D/Mono (29861): GC_BRIDGE: 完成,运行了 0.07ms00ms 外部参照设置 0.01ms 清理 0.00ms 04-03 19:14:09.959 D/Mono (29861): GC_BRIDGE: 完成,运行了 0.07ms00ms 外部参照设置 0.01ms 清理 0.00ms 04-03 19:14:09.959 D/Mono (29861): GC_BRIDGE: 完成,运行了 0.07ms

标签: c#eventstostring

解决方案


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


推荐阅读