<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-15137028.post7366553199227939709..comments</id><updated>2010-07-06T11:13:23.295+02:00</updated><category term='C#'/><category term='Coding Guidelines'/><category term='dotnetmag'/><category term='Visual Studio'/><category term='Fluent Assertions'/><category term='WCF RIA Services'/><category term='ALM'/><category term='Architecture'/><category term='Agile'/><category term='WCF'/><category term='CQRS'/><category term='DevDays09'/><category term='Cookbook'/><category term='TFS'/><category term='DevDays10'/><category term='ALM Practices'/><category term='Events'/><category term='Silverlight'/><category term='InRetrospect'/><category term='Testing'/><category term='Quality'/><title type='text'>Comments on Dennis Doomen.NET: Coding Guidelines for C# 3.0 and C# 4.0 now availa...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.dennisdoomen.net/feeds/7366553199227939709/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default'/><link rel='alternate' type='text/html' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html'/><author><name>Dennis Doomen</name><uri>http://www.blogger.com/profile/04363006875303293621</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp1.blogger.com/_sv2gnsft17w/R75sgsYv9gI/AAAAAAAABHY/ezDFaHgAteA/S220/Dennis.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-15137028.post-7298330673601741331</id><published>2010-07-06T11:13:23.295+02:00</published><updated>2010-07-06T11:13:23.295+02:00</updated><title type='text'>Fair enough. I agree on your distinction between I...</title><content type='html'>Fair enough. I agree on your distinction between IEnumerable and IQueryable. For the rest maybe it&amp;#39;s just a matter of scope. As far as let&amp;#39;s say internal methods are concerned (domain classes and domain services) I like the approach &amp;quot;return what you create&amp;quot;, just to remind me where execution is deferred and where it isn&amp;#39;t. Methods exposed in service boundaries, facades, and the like are a different story, though. There I tend to return the least explicit type, which in most cases would be an interface, as your guideline (1025) suggests.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/7298330673601741331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/7298330673601741331'/><link rel='alternate' type='text/html' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html?showComment=1278407603295#c7298330673601741331' title=''/><author><name>Gert</name><uri>http://www.blogger.com/profile/04817069977527539236</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html' ref='tag:blogger.com,1999:blog-15137028.post-7366553199227939709' source='http://www.blogger.com/feeds/15137028/posts/default/7366553199227939709' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1752074153'/></entry><entry><id>tag:blogger.com,1999:blog-15137028.post-1630679875529388892</id><published>2010-07-05T16:32:56.629+02:00</published><updated>2010-07-05T16:32:56.629+02:00</updated><title type='text'>Thanks Gert. I really appreciate that.

For the re...</title><content type='html'>Thanks Gert. I really appreciate that.&lt;br /&gt;&lt;br /&gt;For the record, I disagree with your approach. The fact that a method or property returns an IEnumerable simply indicates that the receiver will get some kind of collection, and that it should not make any assumptions about the actual collection class.&lt;br /&gt;&lt;br /&gt;I would never return a IQueryable as an IEnumerable. I have seen some horrible bugs because the caller wasn&amp;#39;t aware that its evaluation was deferred. If the caller is supposed to tweak the query somehow, I make it explicit by returning an IQueryable.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/1630679875529388892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/1630679875529388892'/><link rel='alternate' type='text/html' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html?showComment=1278340376629#c1630679875529388892' title=''/><author><name>Dennis Doomen</name><uri>http://www.blogger.com/profile/04363006875303293621</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='30' height='32' src='http://bp1.blogger.com/_sv2gnsft17w/R75sgsYv9gI/AAAAAAAABHY/ezDFaHgAteA/S220/Dennis.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html' ref='tag:blogger.com,1999:blog-15137028.post-7366553199227939709' source='http://www.blogger.com/feeds/15137028/posts/default/7366553199227939709' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-2136795164'/></entry><entry><id>tag:blogger.com,1999:blog-15137028.post-533180935668936181</id><published>2010-07-05T10:42:29.654+02:00</published><updated>2010-07-05T10:42:29.654+02:00</updated><title type='text'>A recommendable resource! Very thought-provoking, ...</title><content type='html'>A recommendable resource! Very thought-provoking, even embarrassing at times... To add one of my thoughts: I could&amp;#39;nt agree more with AV1076 (Evaluate the result of a LINQ expression before returning it) to avoid the pitfalls of deferred execution. However, to make clear that my method returns an evaluated list I tend to return a List in stead of IEnumerable, so a consumer of the method knows that evaluating the result is not necessary. But then there is the other useful guideline, AV1025 (Return an IEnumerable or ICollection instead of a concrete collection class). To me, methods returning IEnumerable, in contrast to Lists or Arrays, convey the message that execution is deferred (as most LINQ methods do): &amp;quot;I just offer an enumerator, you enumerate it whenever you want&amp;quot;. So unconsciously I made my own guideline: use IEnumerable as return type to communicate that execution may be deferred. What do you (and others) think?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/533180935668936181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15137028/7366553199227939709/comments/default/533180935668936181'/><link rel='alternate' type='text/html' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html?showComment=1278319349654#c533180935668936181' title=''/><author><name>Gert</name><uri>http://www.blogger.com/profile/04817069977527539236</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.dennisdoomen.net/2010/06/coding-guidelines-for-c-30-and-c-40-now.html' ref='tag:blogger.com,1999:blog-15137028.post-7366553199227939709' source='http://www.blogger.com/feeds/15137028/posts/default/7366553199227939709' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1752074153'/></entry></feed>
