我想从 C# 中的 ArrayList 的项目中删除所有“\0”字符。这是我的代码:
ArrayList users = um.getAllUsers(server,Instance); //user count=3
所以现在我想添加一个代码,以便将列表中所有项目中的所有“\0”替换为空字符串。
这可能吗?
最佳答案
首先,仍然使用 ArrayList
有点奇怪在 2010 年...并且还有驼峰命名( getAllUsers
而不是 GetAllUsers
),但仍然...
for (int i = 0; i < users.Count; i++)
{
string user = (string) users[i];
user = user.Replace("\0", "");
users[i] = user;
}
关于c# - 如何更改ArrayList的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3404507/