C#占用cpu资源,把电源变成暖手宝
效果如图:

1FY3MLJ}2ZK34@~L$O)D~{3.png

代码如下:

    using System.Threading;
    
    namespace 占用cpu资源
    {
        class Program
        {
            static void Main(string[] args)
            {
                Thread a = new Thread(new ThreadStart(XianChengYi));
                a.Start();
                Thread b = new Thread(new ThreadStart(XianChengYi));
                b.Start();
                Thread c = new Thread(new ThreadStart(XianChengYi));
                c.Start();
                Thread d = new Thread(new ThreadStart(XianChengYi));
                d.Start();
                Thread e = new Thread(new ThreadStart(XianChengYi));
                e.Start();
                Thread f = new Thread(new ThreadStart(XianChengYi));
                f.Start();
                Thread g = new Thread(new ThreadStart(XianChengYi));
                g.Start();
                Thread h = new Thread(new ThreadStart(XianChengYi));
                h.Start();
                Thread i = new Thread(new ThreadStart(XianChengYi));
                i.Start();
                Thread j = new Thread(new ThreadStart(XianChengYi));
                j.Start();
                Thread k = new Thread(new ThreadStart(XianChengYi));
                k.Start();
                Thread l = new Thread(new ThreadStart(XianChengYi));
                l.Start();
                Thread m = new Thread(new ThreadStart(XianChengYi));
                m.Start();
                Thread n = new Thread(new ThreadStart(XianChengYi));
                n.Start();
                Thread r = new Thread(new ThreadStart(XianChengYi));
                r.Start();
            }
    
            private static void XianChengYi()
            {
                while (true)
                {
                    string s = "asdahsdjah";
                    string m = "ashjdjkahskdh";
                    s = s + m;
                }
            }
        }
    }
用代码书写山河的壮丽
本文作者:
文章标题:C#占用cpu资源,冬天到了,电源变暖手宝
本文地址:http://oddfar.com/archives/51/
版权说明:知识共享署名-非商业性使用 4.0 国际协议进行许可
转载声明:转载请附上原文出处链接和本声明
最后修改:2021 年 03 月 21 日 12 : 28 PM
如果觉得我的文章对你有用,请随意赞赏