alexk schrieb:
> Hi,
> Is reflection (e.g. GetField) is possible on a __ComObject ?
>
> 10x, Alex.
Hi Alex,
no, because a __ComObject means that it is just any COM object (it is
not known which interfaces the object implements). You can try to cast
it to an interface, then you can do reflection on it too.
HTH,
Michael

Signature
http://www.mkcs.at/
The specified e-mail-address is valid and will be read.
alexk - 28 Jun 2005 04:54 GMT
> not known which interfaces the object implements). You can try to cast
> it to an interface, then you can do reflection on it too.
Michael, thank you for your answer.
AFAIK, you don't do refleciont on interfaces but on objects.
So I believe your suggestion won't work, e.g.
PrpertyInfo pi = typeof(IInterface).GetProperty(fieldName,
_BindingFlags.Instance Or BindingFlags.Public);
pi.GetValue(obj,Nothing)
Michael Kremser - 28 Jun 2005 06:59 GMT
alexk schrieb:
> AFAIK, you don't do refleciont on interfaces but on objects.
That's right. I wrote you have to *cast* to an interface, just like this:
IInterface ii = obj as IInterface;
If (ii!=null)
{
PropertyInfo pi =
ii.GetType().GetProperty(fieldName,BindingFlags.Instance |
BindingFlags.Public);
object oValue = pi.GetValue(obj,null);
}
HTH,
Michael

Signature
http://www.mkcs.at/
The specified e-mail-address is valid and will be read.