LINQ: Select an object, but change some properties without creating a new object
Q: Using LINQ, if I wanted to perform some query and return the object from the query, but change only some of the properties in that object, how would I do this without creating a new object and...
View ArticleASP.NET Data Caching Helper Extension Method
Sometimes ASP.NET output caching doesn’t do the trick and you need to implement data caching to avoid trips to the database or to external API’s. Data caching is pretty simple- check the cache via a...
View ArticleParse the Domain from a URL String with a C# Extension Method
Many times I’ll need to parse the domain name, including the http[s]:// from a URL. Yet there’s no straightforward way to get it using the Uri class. This is especially useful when writing custom...
View ArticleTruncate HTML String C# Extension Method
My client, a super-huge pharmaceutical company, gave me a particularly good challenge: take a string of HTML and truncate it to a maximum amount of characters, keeping only whole words and all markup....
View Article