Some cleanup with foreach

This commit is contained in:
Cinder
2021-07-25 11:10:52 -05:00
parent 8fefc903b3
commit d19333058d
42 changed files with 186 additions and 224 deletions

View File

@@ -49,7 +49,7 @@ namespace OpenMetaverse.TestClient
{
result.AppendFormat(System.Environment.NewLine + "* {0} Related Commands:" + System.Environment.NewLine, kvp.Key.ToString());
int colMax = 0;
for (int i = 0; i < kvp.Value.Count; i++)
foreach (var val in kvp.Value)
{
if (colMax >= 120)
{
@@ -57,7 +57,7 @@ namespace OpenMetaverse.TestClient
colMax = 0;
}
result.AppendFormat(" {0,-15}", kvp.Value[i].Name);
result.AppendFormat(" {0,-15}", val.Name);
colMax += 15;
}
result.AppendLine();

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using OpenMetaverse;
@@ -23,9 +24,7 @@ namespace OpenMetaverse.TestClient
public override string Execute(string[] args, UUID fromAgentID)
{
string masterName = String.Empty;
for (int ct = 0; ct < args.Length;ct++)
masterName = masterName + args[ct] + " ";
string masterName = args.Aggregate(string.Empty, (current, t) => current + t + " ");
masterName = masterName.TrimEnd();
if (masterName.Length == 0)

View File

@@ -23,9 +23,9 @@ namespace OpenMetaverse.TestClient
lock (Client.Network.Simulators)
{
for (int i = 0; i < Client.Network.Simulators.Count; i++)
foreach (var sim in Client.Network.Simulators)
{
Avatar master = Client.Network.Simulators[i].ObjectsAvatars.Find(
Avatar master = sim.ObjectsAvatars.Find(
avatar => avatar.ID == Client.MasterKey
);