清单和清除方法存在问题:
|
Dictionary<string, List<DisplayAllQuestionsTable>> tPages= new Dictionary<string, List<DisplayAllQuestionsTable>>();;
List<DisplayAllQuestionsTable> threadsByTopic = new List<DisplayAllQuestionsTable>();
int tPage=0;
foreach (var topicKeys in postsByTopic)
{
if (topicKeys.Key == subTopic)
{
foreach (var item in postsByTopic[topicKeys.Key])
{
questionNumber++;
maximumTopicPages++;
threadsByTopic.Add(item);//Adds All DisplayAllTables objects
//if there are 20 add a button.
if (maximumTopicPages == 20)
{
tPages.Add(tPage.ToString(), threadsByTopic);//The threadsByTopic clears everytime i call threadsByTopic.clear()
threadsByTopic.Clear();
tPage++;
}
}
我知道,如果它是一个引用,则它的引用是按值传递的。但是,如果我将其threadByTopic列表添加到字典中,是否按原样保存...?还是必须重置?
没有找到相关结果
已邀请:
1 个回复
掀辟髓观粟