Re: Reflect on a property of a property

by Mattias Sjögren on 11/2/2007 12:30:00 AM Barry,

>Dim myType As Type=Me.GetType
>For Each mi As MemberInfo In itemType.GetMembers(BindingFlags.Public Or _
> BindingFlags.SetProperty Or BindingFlags.Instance Or _
> BindingFlags.Static Or BindingFlags.NonPublic)
>myType.GetProperty(mi.Name).GetValue(me,nothing).GetType.GetProperty("ShiftId").GetValue(
>
>I'm stuck on the object to pass into the last GetValue call. I;m not sure
>how to get a reference to the object contained in the outer class's property.

You're already getting the reference (with GetValue), you just have to
hold on to it

Dim shift As Object
Dim shiftId As Object
shift = myType.GetProperty(mi.Name).GetValue(me,nothing)
shiftId = shift.GetType.GetProperty("ShiftId").GetValue(shift,
Nothing)


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.