如何查看每个ilist< object>在图像中 [英] How do I see each ilist<object> in image
本文介绍了如何查看每个ilist< object>在图像中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
Hello,
IList<Object> playerlist = new List<Object>();
playerlist.Add(new Player() { Account_Level = "", ChampionName = "", Tier = "", playerName = "", taskForce = "", tierLosses = 0, tierWins = 0 });
我想在不同的地方看到每个对象Image我这样做:
我尝试了什么:
I want to see each object in differents Image so I do :
What I have tried:
for (int i = 0; i < playersimages_team_1.Length; i++)
{
foreach(Player player in playerlist)
{
SetChampionImg(player,playersimages_team_1[i])//void SetChampionImg(string ChampionName, Image PlayerSelected)
}
}
但这只给我每张图片中的最后一个对象:/,我的赌注是继续;但似乎没有用。
But this give me only the last Object in every Image :/, my bet is on "continue;" but don't seem to work.
推荐答案
for (int i = 0; i < playersimages_team_1.Length; i++)
{
foreach(Player player in playerlist)
{
SetChampionImg(player,playersimages_team_1[i]);
}
}
内循环和外循环之间没有连接...
内循环推动所有玩家(一个接一个)到 playersimages_team_1 [i] ,覆盖前一个,因为 i 只在外循环中迭代,在内部用尽之后。 。
这样的事情可以解决问题:
There is no connection between the inner and outer loop...
The inner loop pushes all the players (one-by-one) to playersimages_team_1[i], overwriting the previous, as i iterates only in the outer loop, after the inner ran out...
Something like this may solve the problem:
int i = 0;
foreach(Player player in playerlist)
{
SetChampionImg(player,playersimages_team_1[i]);
i++;
}
这篇关于如何查看每个ilist< object>在图像中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文