我有一个物体。我可以尝试以某种方式遍历此对象的索引吗?
例如:
object[] someObjects = new object[]
{
"a string",
new Position(5, 2, 1), // Position is indexed: position[0] -> 5
10
};
foreach (object obj in someObjects)
{
for (int i = 0; i < obj.indexRange; i++)
{
obj[i] += 3;
}
}