我正在尝试使用以下代码枚举 Microsoft.Office.Interop.Outlook.ContactItem 对象(我们称之为 ci)的属性:
        System.Reflection.BindingFlags bf = System.Reflection.BindingFlags.Default;
        foreach (System.Reflection.PropertyInfo pi in ci.GetType().GetProperties(bf))
        {
            Console.WriteLine("Property Info {0}", pi.Name);
        }
我实际上尝试了几种 BindingFlag 值的组合,但没有返回任何属性。
这就是 ContactItem 的定义方式:使用 System.Runtime.InteropServices;
namespace Microsoft.Office.Interop.Outlook
{
    [Guid("00063021-0000-0000-C000-000000000046")]
    [CoClass(typeof(ContactItemClass))]
    public interface ContactItem : _ContactItem, ItemEvents_10_Event
    {
    }
}
这就是 _ContactItem 的定义方式(为简单起见,我只保留了 3 个道具):
using System;
using System.Runtime.InteropServices;
namespace Microsoft.Office.Interop.Outlook
{
    [TypeLibType(4160)]
    [Guid("00063021-0000-0000-C000-000000000046")]
    public interface _ContactItem
    {
       [DispId(14848)]
       string Account { get; set; }
       [DispId(63511)]
       Actions Actions { get; }
       [DispId(14913)]
       DateTime Anniversary { get; set; }
    }
}
有人可以帮我吗?
提前致谢
鲍勃