Archives

Archives / 2011 / November
  • Handy EnumerableExtensions

    There’s a great site for finding extension methods, ExtensionMethod.net.  I don’t believe either of these came from there, and I’ve not (yet) submitted them there, but here are a couple of extensions on IEnumerable<T> that I’ve found useful recently. ForEach<T> The first one is simply a method that allows you to easily iterate over a sequence and perform an action on it.  This is a pretty commonly useful extension method, so much so that it’s now included in .NET 4.0 out of the box.  But if you’re using an older version of the framework, this is one you can roll yourself. public static void ForEach<T>(this IEnumerable<T> items, … more

  • View HTML Source of Email in GMail and Google Apps

    If you’re working on creating a pleasant-looking HTML email template for your site’s newsletter, you’ll want to test it out on the major email clients, including Outlook and GMail.  For instance, if you get The Code Project’s Insider Daily News in your GMail inbox, it will look something like this: Now, if you view the source for this page, you’ll get something that’s less than useful.  The whole thing looks like a giant <script> block and has no relation to the HTML that was in your email template.  Of course, the interface uses frames (iframes), and depending on your browser you can also view the frame source: Which will yield this: How useful! If you … more