小编hat*_*jie的帖子

添加断点时,C#程序在文件中生成相同的输出

我想生成160个不同的随机用户和密码,现在当我在用户和密码变量(在for循环中)添加断点时,代码似乎工作正常.但是当我运行没有断点的代码时,Passwords.csv对所有160行都有相同的输出.任何帮助表示赞赏

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace WriteCSVPasswords
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"c:\temp\Passwords.csv";
            string user = null;
            string password = null;
            string[] file = new string[160];

            for (int i = 0; i < 160; i++)
            {
                user = CreatePassword(4);
                password = CreatePassword(5);
                file[i] = user + ";" + password + ";" + Base64Encode(user + ":" + password);
                user = null;
                password = null;
            }

            if …
Run Code Online (Sandbox Code Playgroud)

c#

1
推荐指数
1
解决办法
50
查看次数

标签 统计

c# ×1