<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Use C# dynamic typing to conveniently access internals of an object</title>
	<atom:link href="http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/</link>
	<description>On programming, technology, and random things of interest</description>
	<lastBuildDate>Thu, 02 Feb 2012 01:36:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: mukti</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-2654</link>
		<dc:creator>mukti</dc:creator>
		<pubDate>Sat, 16 Apr 2011 10:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-2654</guid>
		<description>class ExposedObjectSimple : DynamicObject 
{
    private object m_object;

    public ExposedObjectSimple(object obj)
    {
        m_object = obj;
    }

    public override bool TryInvokeMember(
            InvokeMemberBinder binder, object[] args, out object result)
    {
        // Find the called method using reflection
        var methodInfo = m_object.GetType().GetMethod(
            binder.Name,
            BindingFlags.NonPublic &#124; BindingFlags.Public &#124; BindingFlags.Instance);

        // Call the method
        result = methodInfo.Invoke(m_object, args);
        return true;
    }
}</description>
		<content:encoded><![CDATA[<p>class ExposedObjectSimple : DynamicObject<br />
{<br />
    private object m_object;</p>
<p>    public ExposedObjectSimple(object obj)<br />
    {<br />
        m_object = obj;<br />
    }</p>
<p>    public override bool TryInvokeMember(<br />
            InvokeMemberBinder binder, object[] args, out object result)<br />
    {<br />
        // Find the called method using reflection<br />
        var methodInfo = m_object.GetType().GetMethod(<br />
            binder.Name,<br />
            BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);</p>
<p>        // Call the method<br />
        result = methodInfo.Invoke(m_object, args);<br />
        return true;<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Igor Ostrovsky</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-1056</link>
		<dc:creator>Igor Ostrovsky</dc:creator>
		<pubDate>Thu, 29 Jul 2010 00:28:29 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-1056</guid>
		<description>Yeah, I use it for testing as well.

BTW, nice blog that you have there.</description>
		<content:encoded><![CDATA[<p>Yeah, I use it for testing as well.</p>
<p>BTW, nice blog that you have there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Gfader</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-1055</link>
		<dc:creator>Peter Gfader</dc:creator>
		<pubDate>Wed, 28 Jul 2010 22:44:45 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-1055</guid>
		<description>Nice work!!

I had this idea 1 week ago... Way tooo late ;-)
And works PERFECT for testing! 
And ONLY for testing!

cu</description>
		<content:encoded><![CDATA[<p>Nice work!!</p>
<p>I had this idea 1 week ago&#8230; Way tooo late <img src='http://igoro.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /><br />
And works PERFECT for testing!<br />
And ONLY for testing!</p>
<p>cu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mauricio Scheffer</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-936</link>
		<dc:creator>Mauricio Scheffer</dc:creator>
		<pubDate>Mon, 17 May 2010 23:27:33 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-936</guid>
		<description>&lt;a href=&quot;http://bugsquash.blogspot.com/2009/05/testing-private-methods-with-c-40.html&quot; rel=&quot;nofollow&quot;&gt;I&#039;ve been using this technique&lt;/a&gt; for some time, it&#039;s cool to see that someone got the same idea and wrote a proper implementation :-)</description>
		<content:encoded><![CDATA[<p><a href="http://bugsquash.blogspot.com/2009/05/testing-private-methods-with-c-40.html" rel="nofollow">I&#8217;ve been using this technique</a> for some time, it&#8217;s cool to see that someone got the same idea and wrote a proper implementation <img src='http://igoro.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-901</link>
		<dc:creator>Vince</dc:creator>
		<pubDate>Sun, 02 May 2010 15:08:36 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-901</guid>
		<description>Mark, internals are usually best left untouched yes, that&#039;s a core concept of OO programming, duh :)

I could see how this code could be useful in a debugging session where you don&#039;t have access to the code and you want to reflect over the hidden properties in order to identify an issue with a vendors library.

Handy stuff to know.</description>
		<content:encoded><![CDATA[<p>Mark, internals are usually best left untouched yes, that&#8217;s a core concept of OO programming, duh <img src='http://igoro.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I could see how this code could be useful in a debugging session where you don&#8217;t have access to the code and you want to reflect over the hidden properties in order to identify an issue with a vendors library.</p>
<p>Handy stuff to know.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: .NET 4.0 DLR: ExposedObject Class &#171; Zor&#39;s Blog</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-899</link>
		<dc:creator>.NET 4.0 DLR: ExposedObject Class &#171; Zor&#39;s Blog</dc:creator>
		<pubDate>Sun, 02 May 2010 00:24:22 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-899</guid>
		<description>[...] in Programming    Igor Ostrovsky made an interesting post on his blog, where he implements an ExposedObject class, which allows to take the private fields of an object [...]</description>
		<content:encoded><![CDATA[<p>[...] in Programming    Igor Ostrovsky made an interesting post on his blog, where he implements an ExposedObject class, which allows to take the private fields of an object [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-892</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Wed, 28 Apr 2010 18:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-892</guid>
		<description>While I am a .Net developer to the core, most dynamic languages don&#039;t have a real concept of access modifiers. You can re-write any part of Ruby you want, and JavaScript is wide open for modification whenever you feel like it.

I am not a Ruby guy, but I use JavaScript a lot, and the complete freedom to change behavior hasn&#039;t screwed me yet. In fact, it opens up a lot of possibilities.

Cliff jumping into a lake isn&#039;t as safe as the diving board at your public pool; cliff diving is certainly a lot more fun!</description>
		<content:encoded><![CDATA[<p>While I am a .Net developer to the core, most dynamic languages don&#8217;t have a real concept of access modifiers. You can re-write any part of Ruby you want, and JavaScript is wide open for modification whenever you feel like it.</p>
<p>I am not a Ruby guy, but I use JavaScript a lot, and the complete freedom to change behavior hasn&#8217;t screwed me yet. In fact, it opens up a lot of possibilities.</p>
<p>Cliff jumping into a lake isn&#8217;t as safe as the diving board at your public pool; cliff diving is certainly a lot more fun!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: K. L. Estes</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-890</link>
		<dc:creator>K. L. Estes</dc:creator>
		<pubDate>Wed, 28 Apr 2010 16:59:17 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-890</guid>
		<description>Generally, yes.  But there are extenuating circumstances, as the man said.  Besides, the man didn&#039;t argue that it was a good thing on the whole, he just showed you how it _could_ be done.  Microsoft probably does stuff like this behind the scenes 20 times a day - not that thats a good thing on the whole, either !</description>
		<content:encoded><![CDATA[<p>Generally, yes.  But there are extenuating circumstances, as the man said.  Besides, the man didn&#8217;t argue that it was a good thing on the whole, he just showed you how it _could_ be done.  Microsoft probably does stuff like this behind the scenes 20 times a day &#8211; not that thats a good thing on the whole, either !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Broadhurst</title>
		<link>http://igoro.com/archive/use-c-dynamic-typing-to-conveniently-access-internals-of-an-object/comment-page-1/#comment-889</link>
		<dc:creator>Mark Broadhurst</dc:creator>
		<pubDate>Wed, 28 Apr 2010 16:00:31 +0000</pubDate>
		<guid isPermaLink="false">http://igoro.com/?p=556#comment-889</guid>
		<description>Err that doesn&#039;t look like a good thing on the whole.
Internals are generally internal for a reason.</description>
		<content:encoded><![CDATA[<p>Err that doesn&#8217;t look like a good thing on the whole.<br />
Internals are generally internal for a reason.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

