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 [...]

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

Ben Griswold on December 12th, 2008

The Cache Helper Class has been updated so that it is no longer limited by the generic constraint.  The original post has been updated along with a sample project for download.  Let me know what think.  I know I’m much happy with this solution.  As always, thanks for your comments and thanks for letting me [...]

Continue reading about C# Cache Helper Class Revisited

Ben Griswold on December 10th, 2008

Do you need a quick and cache wrapper class? Here’s a static class which I included in my more recent C# web application.  You’ll notice the class uses generics to allow for some, umm, generic functionality.  public static class CacheHelper { /// <summary> /// Insert value into the cache using /// appropriate name/value pairs /// [...]

Continue reading about C# Cache Helper Class

Ben Griswold on July 3rd, 2008

I have collected a reasonably good size library of C# helper files over the years.  The EncryptionHelper below is one of many which I plan to share. using System; using System.Security.Cryptography; using System.Text; namespace Common { public static class EncryptionHelper { private const string cryptoKey = “cryptoKey”; // The Initialization Vector for the DES encryption [...]

Continue reading about C# Encryption / Decryption Helper Class

Ben Griswold on January 7th, 2008

After hours of discussions and documentation, we had a good understanding of the functional requirements.  The ask was for a very complex, intelligent and “AJAXy” web application which would give financial advisors the ability to rebalance their clients’ portfolios based on a specified investment objective.  Everyone was excited (especially me) until the final requirement was [...]

Continue reading about Undo Functionality with a Limited Stack

Ben Griswold on June 20th, 2007

This question circulates through the office about once a year.  “Um, I have Windows service which processes requests which are queued in a database table.  Everything is working great, but I would like to add a second instance of the service and I need to know the best way to ensure the services don’t step [...]

Continue reading about What’s the Best Way to Manage a Database Queue?

Ben Griswold on February 7th, 2007

Out of the box, you can do a lot with the DataView.RowFilter property, but you can’t make use of the top clause. However, if the view contains a column with unique values, you can obtain the same results by setting the Sort property and then generating a RowFilter which uses the in condition. Here’s a [...]

Continue reading about DataView.RowFilter Top Rows

Ben Griswold on January 22nd, 2007

Disclaimer: If I were a betting man, I would bet there’s some code which does the following kicking around a forum, blog or two already.  Simply, I wasn’t lucky enough to find it.  Hence, the IF in “if I were a betting man.” I ran into a case today where I wanted to reduce unused [...]

Continue reading about C# RoundToInterval()