我有一个
的队列集合var queue = new Queue<ExchangeEmailInformation>(mailInformation);
包含两条记录。我还有Guid数组
public static List<Guid> FolderId { get; set; }
包含两个guid记录。我需要将这些guid重新分配给Queue的财产集合 FolderId.How我可以这样吗? 以下是ExchangeEmailInformation类
public class ExchangeEmailInformation:IEmailInformation
{
public string Subject { get; set; }
public string Sender { get; set; }
public AttachmentCollection Attachment { get; set; }
public Guid FolderId { get; set; }
}
答案 0 :(得分:0)
var currentQueue = queue.ToList();
for (int i = 0; i < currentQueue.Count; i++)
{
currentQueue[i].FolderId = FolderId[i];
}
答案 1 :(得分:0)
不是将值复制到列表,而是可以枚举队列并保留计数器
int i =0;
foreach (var email in queue)
{
email.FolderId = this.FolderID[i];
i++;
}