|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
AmbiguousMatchException when getting property of a contro through reflectionl...The Type.GetProperty() method is throwning "AmbiguousMatchException" when getting value of control class through reflection. The exception occurs under the following cases. 1. The class is derived from other class 2. Any of the parent class property is either overridden or shadowed in the derived class 3. and trying to get the property value through reflection of the derived class. Which set of BindingFlags should be used in this case ? Any help on this, is greatly appreciated Regards, ....Ashok ------------------------------------------------------------------------ "It is beautiful for an engineer to shape and design the same way that an artist shapes and designs. But whether the whole process makes any sense, whether men become happier - that I can no longer decide." - Rudolph Diesel Try with BindingFlags.DeclaredOnly (IIRC) to get only members declared in
the derived class, not in the base(s) class(es). -- Show quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA You can code, design and document much faster. Free resources for add-in developers: http://www.mztools.com "G.Ashok" <gw2ks***@hotmail.com> escribió en el mensaje news:u3b55Pe5FHA.3188@TK2MSFTNGP15.phx.gbl... > Hello, > > The Type.GetProperty() method is throwning "AmbiguousMatchException" > when getting value of control class through reflection. > > > The exception occurs under the following cases. > > > 1. The class is derived from other class > 2. Any of the parent class property is either overridden or shadowed in > the > derived class > 3. and trying to get the property value through reflection of the derived > class. > > > > Which set of BindingFlags should be used in this case ? > > > Any help on this, is greatly appreciated > > > Regards, > ...Ashok > ------------------------------------------------------------------------ > "It is beautiful for an engineer to shape and design the same way > that an artist shapes and designs. But whether the whole process > makes any sense, whether men become happier - that I can no > longer decide." - Rudolph Diesel > > Dear Carlos,
Thanks for the suggetion. I already tried it. infact almost every possble combinations of the BindingFlags but failed to get it. Is there any bug in CLR etc.? Regards, ....Ashok ------------------------------------------------------ Make it real or else forget about it -- Carlos Santana Show quote "Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> wrote in message news:eaCyw0f5FHA.620@TK2MSFTNGP12.phx.gbl... | Try with BindingFlags.DeclaredOnly (IIRC) to get only members declared in | the derived class, not in the base(s) class(es). | | -- | | Best regards, | | Carlos J. Quintero | | MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA | You can code, design and document much faster. | Free resources for add-in developers: | http://www.mztools.com | | "G.Ashok" <gw2ks***@hotmail.com> escribió en el mensaje | news:u3b55Pe5FHA.3188@TK2MSFTNGP15.phx.gbl... | > Hello, | > | > The Type.GetProperty() method is throwning "AmbiguousMatchException" | > when getting value of control class through reflection. | > | > | > The exception occurs under the following cases. | > | > | > 1. The class is derived from other class | > 2. Any of the parent class property is either overridden or shadowed in | > the | > derived class | > 3. and trying to get the property value through reflection of the derived | > class. | > | > | > | > Which set of BindingFlags should be used in this case ? | > | > | > Any help on this, is greatly appreciated | > | > | > Regards, | > ...Ashok | > ------------------------------------------------------------------------ | > "It is beautiful for an engineer to shape and design the same way | > that an artist shapes and designs. But whether the whole process | > makes any sense, whether men become happier - that I can no | > longer decide." - Rudolph Diesel | > | > | | G.Ashok wrote:
Show quote > Hello, Could you show us some code that gives this problem? When I construct a> > The Type.GetProperty() method is throwning "AmbiguousMatchException" > when getting value of control class through reflection. > > > The exception occurs under the following cases. > > > 1. The class is derived from other class > 2. Any of the parent class property is either overridden or shadowed in the > derived class > 3. and trying to get the property value through reflection of the derived > class. test harness doing what you say, it works fine for me. -- Larry Lard Replies to group please |
|||||||||||||||||||||||