New Sniptaculous version

I’ve just updated Snipatculous, my Visual Studio snippets collection to version 1.01. I’m using it daily at this point and I really like how fast it can make certain scenarios.

For example, ifany will expand to :

if ($value$ != null && $value$.Any())
    // cursor ends here instead of comment
    // after value has been replaced

The main issue is the installation which consists of a file copy in Visual Studio’s snippet directory. I’ll have to investigate if I could make a Visual Studio Extension that would facilitate the installation procedure and make it seem less barbaric.

Visual Studio quick tip: Use diff for any file

It’s possible to use the Visual Studio diff tool to compare any two files.

In the Command Window type in Tools.DiffFiles followed by the two filenames. You will see there is even an auto-completion feature.


While external diff tools can be better than Visual Studio’s built-in, it has the advantage of being available everywhere you have a Visual Studio install (like on a client’s machine where you can’t install software, or a co-worker’s machine when you are giving him a helping hand).

It’s a very solid diff tool and Visual Studio users are already familiar with it from using it for merges.

SonarLint Visual Studio Extension / C# Linter








Things like needlessly nested if statements:

if (FirstProperty == false) 
    if (NeedlesslyDeeplyScoped == true)
    { }

Using a Count() instead of an Any:

if (files.Count(f => f.IsDeleted) > 0)
// to
if (files.Any(f => f.IsDeleted))

To foreach statements that can run on null variables:

List<Foo> myCollection = null;

if (IsWeatherRainy) 
    myCollection = new List<Foo>();
    // add stuff

// myColllection null on at least one execution path
foreach (var item in myCollection)

Or overlapping method signatures with optional parameters that can’t be used:

// This method's signature overlaps the second one
// and the default parameter value can't be used
public File GetFile(bool firstParam, 
                    bool secondParam = false)
    return new File();

public TestFile GetFile(bool firstParam)
    return new TestFile();




Sniptaculous, a C# snippet library

Sniptaculous, a C# snippet library

I’ve just released the first version of Sniptaculous, a Visual Studio C# snippet library.

I think the existing snippets are great. They have parameters and some of them, such as the switch snippet (sw), will expand and make all of the switch cases for you if you use an existing enum as the parameter.

Since I love snippets and I find they speed up development, I’ve made some of my own. Over 50 snippets in fact.

I will continue adding to and refining Sniptaculous. I’m always open to suggestions and pull requests.