这意味着什么?很快,首先我有一些数据(例如祖父),每个人都有不同数量的儿子,每个儿子都有1个儿子。
我考虑使用3D数组,但是第二个数组的不同数量将无法使用此方法。那我怎么能实现呢?
答案 0 :(得分:0)
您可以使用此功能,例如:
List< List < Element > >
答案 1 :(得分:0)
var multiDimesionalList = new List<List<string>>
{
new List<string> { "List one, Child One", "List one, Child Two", "List one, Child Three" },
new List<string> { "List two, Child One", "List two, Child Two", "List two, Child Three" }
};
您可以根据需要创建一个列表深度,以创建所需的层次结构。
答案 2 :(得分:0)
这是一种方法:
将在示例中使用的测试类:
using System;
using Microsoft.Exchange.WebServices.Data;
using System.Net;
using System.IO;
using System.Diagnostics;
namespace EWS_API
{
class Program
{
static void Main(string[] args)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange010_SP);
service.Credentials = new NetworkCredential("user", "pwd", "domain");
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
// ignore certificate errors
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, errors) => true;
// set ews uri without autodiscover (just for internal use)
service.Url = new Uri("https://fqdn_server/EWS/exchange.asmx");
// filter for only daily mails
SearchFilter searchFilter = new SearchFilter.IsGreaterThan(ItemSchema.DateTimeReceived, DateTime.Now.AddDays(-1));
ItemView itemView = new ItemView(int.MaxValue);
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, searchFilter, itemView);
if (findResults != null && findResults.Items != null && findResults.Items.Count > 0)
foreach (Item item in findResults.Items)
{
EmailMessage message = EmailMessage.Bind(service, item.Id, new PropertySet(BasePropertySet.IdOnly, ItemSchema.Attachments, ItemSchema.HasAttachments));
foreach (Attachment attachment in message.Attachments)
{
if (attachment is FileAttachment)
{
FileAttachment fileAttachment = attachment as FileAttachment;
fileAttachment.Load();
fileAttachment.Load("C:\\temp\\" + fileAttachment.Name);
}
}
Debug.WriteLine(item.Subject);
}
else
Debug.WriteLine("no items");
}
}
}
..它在无尽级别列表中的用法
public class MyClassOfSomeData
{
public int ID { get; set; }
public string Name { get; set; }
//etc...
public List<MyClassOfSomeData> Children = new List<MyClassOfSomeData>();
}