您好,
我新的C#。
我想使用foreach代替。
编码:
String[] properties = new String[] { "co", "extensionAttribute1", "mail" , "homeMDB"};
String[] result = new String[] {};
for (int i = 0; i < properties.Length; i++)
{
searcher.PropertiesToLoad.Add( properties[i] );
}
SearchResult searchresult = searcher.FindOne();
for (int j = 0; j < properties.Length; j++)
{
if (searchresult.Properties.Contains(properties[j]))
{
if (searchresult.Properties[properties[j]][0].ToString() != null)
{
result[j] = searchresult.Properties[properties[j]][0].ToString();
}
}
我试着写用foreach,为sucessful第一的,但现在我不知道如何填写的String []结果:
{C}任何人都可以帮助我吗?