Tag Archives: c sharp

Converting MHTML to HTML

I recently had a need to convert an MHTML file attachment into HTML text so that it could be used as the body of a notification service email. Initially I was overwhelmed by the nature of MHTML’s encoding and document structure. Eventually I settled on the following relatively compact LINQ statement: The idea is to...… read more

Using LINQ “Contains” to Query WCF Data Services

Working on a client project recently I ran into a problem trying to query my WCF Data Service.  I get a list of counties from an ASP .NET MVC 2 application and need to find the matching members who live within those counties.  The obvious solution would be something like this: But wait! It seems...… read more

Visual Basic .NET, the Second-Class Citizen

From the June 2011 issue of Visual Studio Magazine, one of the best arguments for the “reason” why many professional developers prefer C# to Visual Basic .NET: At the dawn of .NET, the problem was that Visual Basic .NET had more limitations with regard to the framework than C#. Given that Visual Basic .NET was...… read more

LINQ to SQL Extension Methods

LINQ to SQL is a powerful component of .NET, however, I often find myself duplicating the same code across projects. I created the following extension methods to make common operations easier to use. The class adds generic methods for Delete(), Save(), Exists(), and IsAttached(). The IsAttached() method is required to make sure that the data...… read more

Does F# Break a Fundamental Principal of .NET?

I recently read an (old) news brief in InformationWeek (September 14, 2009) about a group at Grange using the F# programming language.  For those unfamiliar with it, F# is a relatively new programming language developed by Microsoft Research to target the .NET platform.  It is a functional language that is a variant of the ML...… read more