예제 #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);
        }
예제 #2
0
 public ComPtrPropertyDescriptor(ref ComPtrProperty comPtrProperty, ComPropertyInfo comPropertyInfo, Attribute[] attrs)
     : base(comPtrProperty.Name, attrs)
 {
     _comPtrProperty  = comPtrProperty;
     _comPropertyInfo = comPropertyInfo;
 }