Ejemplo n.º 1
0
        public object TryGetFirstAvailableProperty(string[] propertyNames)
        {
            object      value   = null;
            ComTypeInfo comType = TryGetComTypeInfo();

            if (comType != null)
            {
                foreach (string propertyName in propertyNames)
                {
                    ComPropertyInfo comPropertyInfo = comType.Properties.Where(x => x.Name.Equals(propertyName)).FirstOrDefault();

                    if ((comPropertyInfo != null) && (comPropertyInfo.GetFunction != null))
                    {
                        if (MarshalEx.Succeeded(TryInvokePropertyGet(comPropertyInfo.GetFunction.DispId, out value)))
                        {
                            break;
                        }
                    }
                }
            }

            return(value);
        }
Ejemplo n.º 2
0
 public ComPtrPropertyDescriptor(ref ComPtrProperty comPtrProperty, ComPropertyInfo comPropertyInfo, Attribute[] attrs)
     : base(comPtrProperty.Name, attrs)
 {
     _comPtrProperty  = comPtrProperty;
     _comPropertyInfo = comPropertyInfo;
 }