private IReadOnlyList <DispatchMember> GetMembers() { if (members == null) { members = dispatch.GetMembers().ToArray(); } return(members); }
private static int GetDispIDForName(this IDispatch dispatch, string name) { var dispids = new int[1]; var names = new[] { name }; if (HResult.Succeeded(dispatch.GetIDsOfNames(ref iid, names, 1, 0, dispids))) { return(dispids[0]); } if (name.IsDispIDName(out dispids[0])) { return(dispids[0]); } var member = dispatch.GetMembers().FirstOrDefault(testMember => testMember.Name == name); if (member == null) { throw new MissingMemberException(MiscHelpers.FormatInvariant("The object has no property named '{0}'", name)); } return(member.DispID); }
public static IEnumerable <string> GetPropertyNames(this IDispatch dispatch) { return(dispatch.GetMembers().Select(member => member.Name)); }
private IReadOnlyList <DispatchMember> GetMembers() { return(members ?? (members = dispatch.GetMembers().ToArray())); }