<?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: Overriding ToString() on your objects using reflection</title>
	<atom:link href="http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/feed/" rel="self" type="application/rss+xml" />
	<link>http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/</link>
	<description>Throwaway thoughts from a .net developer</description>
	<lastBuildDate>Sun, 21 Aug 2011 10:25:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: admin</title>
		<link>http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/comment-page-1/#comment-277</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 20 Jul 2010 10:04:49 +0000</pubDate>
		<guid isPermaLink="false">http://idisposable.co.uk/?p=119#comment-277</guid>
		<description>hey Ryan,

Thanks for the reply!  I&#039;ve base classed it and used reflection so that it can cover more than one object.  It works on User, but I also have Transactions (purchases), + a lot of other Dto objects.

So long as all of my Dto objects inherit from this BaseDto, I have a ToString method that will enumerate through all of the properties.

You&#039;re absolutely right - if I&#039;d just been dealing with one object (User) then coming up with something specific would have been more elegant, faster, and avoided the use of reflection, though I needed something generic that could handle pretty much any of my Dto objects (I have about 30) and output it in a useful format, hence the reflection and the base classing.

Hope that helps.

Cheers,
Terry</description>
		<content:encoded><![CDATA[<p>hey Ryan,</p>
<p>Thanks for the reply!  I&#8217;ve base classed it and used reflection so that it can cover more than one object.  It works on User, but I also have Transactions (purchases), + a lot of other Dto objects.</p>
<p>So long as all of my Dto objects inherit from this BaseDto, I have a ToString method that will enumerate through all of the properties.</p>
<p>You&#8217;re absolutely right &#8211; if I&#8217;d just been dealing with one object (User) then coming up with something specific would have been more elegant, faster, and avoided the use of reflection, though I needed something generic that could handle pretty much any of my Dto objects (I have about 30) and output it in a useful format, hence the reflection and the base classing.</p>
<p>Hope that helps.</p>
<p>Cheers,<br />
Terry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Tomlinson</title>
		<link>http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/comment-page-1/#comment-276</link>
		<dc:creator>Ryan Tomlinson</dc:creator>
		<pubDate>Tue, 20 Jul 2010 09:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://idisposable.co.uk/?p=119#comment-276</guid>
		<description>Hi Terry,

I&#039;m not sure I see why you are creating a base class when the exception appears to be specifically for the user business object (unless I have read this wrong).

Is there any reason why you couldn&#039;t just keep things simpler by passing the user object to the exception object and have the exception parse the user object and populate the Data of the exception?

This would reduce complexity and remove the need for reflection.

Ryan</description>
		<content:encoded><![CDATA[<p>Hi Terry,</p>
<p>I&#8217;m not sure I see why you are creating a base class when the exception appears to be specifically for the user business object (unless I have read this wrong).</p>
<p>Is there any reason why you couldn&#8217;t just keep things simpler by passing the user object to the exception object and have the exception parse the user object and populate the Data of the exception?</p>
<p>This would reduce complexity and remove the need for reflection.</p>
<p>Ryan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/comment-page-1/#comment-271</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 13 Jul 2010 15:31:41 +0000</pubDate>
		<guid isPermaLink="false">http://idisposable.co.uk/?p=119#comment-271</guid>
		<description>hey mate,

I only ran it through single passes of generation as opposed to the 10k/100k repetations I&#039;d done previously, and it seemed to make bugger all difference (&gt;0.1ms).

My hope is with these, they&#039;re only really called when something has gone wrong (system exceptions as opposed to business exceptions) so they should hopefully only be hit ~100-200 times per day (on a 70k visitor count).

We&#039;re in the process of setting up a dev environment that we can simulate hits on, so I&#039;ll hopefully blog about the outcomes of that with the new infrastructure soon!

Cheers :)</description>
		<content:encoded><![CDATA[<p>hey mate,</p>
<p>I only ran it through single passes of generation as opposed to the 10k/100k repetations I&#8217;d done previously, and it seemed to make bugger all difference (&gt;0.1ms).</p>
<p>My hope is with these, they&#8217;re only really called when something has gone wrong (system exceptions as opposed to business exceptions) so they should hopefully only be hit ~100-200 times per day (on a 70k visitor count).</p>
<p>We&#8217;re in the process of setting up a dev environment that we can simulate hits on, so I&#8217;ll hopefully blog about the outcomes of that with the new infrastructure soon!</p>
<p>Cheers <img src='http://idisposable.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Mather</title>
		<link>http://idisposable.co.uk/2010/07/overriding-tostring-on-your-objects-using-reflection/comment-page-1/#comment-270</link>
		<dc:creator>Tim Mather</dc:creator>
		<pubDate>Tue, 13 Jul 2010 14:54:10 +0000</pubDate>
		<guid isPermaLink="false">http://idisposable.co.uk/?p=119#comment-270</guid>
		<description>Hi Tez,

I like it, used to do something similar when logging exceptions on an old system, it didn&#039;t use reflection but the Model classes all had a DataTable property that meant I could go through columns in the DataTable and spit out the state of the object in exactly the same way. I know from your previous post you were bothered about performance, does reflection have much of a hit on what your doing?

Thanks

Tim</description>
		<content:encoded><![CDATA[<p>Hi Tez,</p>
<p>I like it, used to do something similar when logging exceptions on an old system, it didn&#8217;t use reflection but the Model classes all had a DataTable property that meant I could go through columns in the DataTable and spit out the state of the object in exactly the same way. I know from your previous post you were bothered about performance, does reflection have much of a hit on what your doing?</p>
<p>Thanks</p>
<p>Tim</p>
]]></content:encoded>
	</item>
</channel>
</rss>

