Category: Snippet

Little pieces of code to make your development better or easier.

Snippet – ToXmlDocument and ToXDocument

ToXmlDocument and ToXDocument Extension Class The other day I found myself working with a XDocument and needed to convert it to a XmlDocument. The best way I found was to make an Extension Class with ToXmlDocument and ToXDocument. Now it

Posted in Snippet Tagged with: , ,

Snippet – Resize Images

Resize Images Move often than not, an image is not the size it needs to be for the intended use. Here is one of my standby snippets to resize images.

Posted in Snippet Tagged with:

Snippet – Auto Restart Windows Service

Auto Restart Windows Service on Rebuild You don’t have to stop and start your service manually with each rebuild. Yes if you have installed your service from the bin folder, then a stop is necessary before you can rebuild. But

Posted in Snippet Tagged with:

Snippet – SQL Properties

What Version SQL is this? Have you ever had to work on a SQL Server remotely and not known for sure what version the engine is? Even recognizing if it is Express or not can be difficult. Here is a little

Posted in Snippet Tagged with:

Snippet – ControlChars

Control Characters can be your best friend. Namespace: Microsoft.VisualBasic Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll) Has you thoughts ever gone blank when trying to remember the right escape character you need to use? ControlChars can make it much easier to remember. They

Posted in Snippet Tagged with: , ,

Snippet – Image to Byte Array and Back

When dealing with image storage, I frequently find myself needing to turn an image into a byte array or vise versa.  He is my go snippet for doing just that.

Posted in Snippet Tagged with:

Snippet – String Contructor

Don’t count spaces when you don’t need to. Namespace: System Dim spacer as New String(” “,6) Result is a string that has 6 space characters Here is the MS Code done for you…

Posted in Snippet Tagged with:

Snippet – toProper

Microsoft can format Proper Case! Namespace: Microsoft.VisualBasic StrConv(“my String”,VbStrConv.ProperCase) Here is the MS Code done for you…

Posted in Snippet Tagged with:

Snippet – Path.Combine

Path Manipulation Made Easy: Namespace: System.IO Path.Combine(String, String) Combine is just my favorite. There are a slew of good ones in this namespace. Here is the MS Code done for you…

Posted in Snippet Tagged with:

Snippet – WriteAllText

Let MicroSoft dispose of the Stream Writer: Namespace: System.IO File.WriteAllText(String, String) Here is the code that is done for you…

Posted in Snippet Tagged with: