Ben Griswold on January 5th, 2010

Some of the ASP.NET 4 improvements around SEO are neat.  The ASP.NET 4 Page.MetaKeywords and Page.MetaDescription properties, for example, are a welcomed change.  There’s nothing earth-shattering going on here – you can now set these meta tags via your Master page’s code behind rather than relying on updates to your markup alone.  It isn’t difficult [...]

Continue reading about ASP.NET Meta Keywords and Description

Ben Griswold on December 22nd, 2009

I hadn’t done much (read: anything) with the C# generic HashSet until I recently needed to produce a distinct collection.  As it turns out, HashSet<T> was the perfect tool.
As the following snippet demonstrates, this collection type offers a lot:

// Using HashSet<T>:
// http://www.albahari.com/nutshell/ch07.aspx
var letters = new HashSet<char>("the quick brown fox");
 
Console.WriteLine(letters.Contains('t')); // true
Console.WriteLine(letters.Contains('j')); // false
 
foreach (char c [...]

Continue reading about C# HashSet<T>

Ben Griswold on April 24th, 2009

As an icebreaker question, I’ve asked several interviewees to name classes that one might find in the System.Collections namespace.  There a quite a few answers to this questions – especially if you start to explore the System.Collections.Specialized namespace.  Though I completely understand why folks might immediately shout out answers like Hashtable, Stack, Queue or ArrayList, [...]

Continue reading about C# HybridDictionary Collection

It doesn’t take much to hack together email functionality using the .NET framework.  In most cases you can new-up a MailMessage reference, assign sender and recipient addresses, provide a subject and a message body, configure your SMTP settings and then send.  Done and done.
But let’s say you need to provide both plain text and HTML [...]

Continue reading about .NET MailMessage, LinkedResources, AlternateViews and Exceptions

Ben Griswold on April 8th, 2009

I read through Jeffrey Richter’s CLR via C# not too long ago.  This evening I cracked it open again and jotted down a few notes on what I personally took away from the book. Of course, if I spent the time to write down everything I learned, I might still be busy writing.  I’ve thrown [...]

Continue reading about 15 Random Things I’ve Learned from Jeffrey Richter

Ben Griswold on February 25th, 2009

I think everyone is familiar with those short urls which are being passed around in applications like Twitter.  It’s pretty neat that there are dozens of services willing to shorten urls for us, but what about lengthening them?  That’s where longurlplease.com comes in.  As they say, they promote safer and productive browsing by lengthening short [...]

Continue reading about Expand Urls with C# and LongUrlPlease

Ben Griswold on January 5th, 2009

.NET Strings are immutable.  StringBuilder should be used to better performance.  Blah… Blah… Blah…  You’ve heard it all before, but what you might not know is how StringBuilder dynamically allocates its capacity.  The simple answer is StringBuilder will double its capacity when its capacity is reached.  In other words, if you add 1 byte to [...]

Continue reading about StringBuilder Required Capacity Algorithm

Ben Griswold on December 18th, 2008

jTemplates is a jQuery plugin and template engine for Javascript.  If you keep up with Dave Ward and/or Rick Strahl you may already be familiar with jTemplates as they have both highlighted the plugin on their respective bolgs.  About 1.5 months ago, however, I got into the action and started using jTemplates in conjunction with [...]

Continue reading about jTemplates with jQuery, AJAX and Json