Category Archives: Code Snippets

nullex, nullempex, nullwex – Surviveplus Code Snippets

Surviveplus Code Snippets

Verify Args

Three code snippets for Visual Studio 2012 & 2013. It is used by Surviveplus.net developers team for Validating Arguments.

  • Throw Exception when argument is the empty string or a null reference [nullempex]
  • Throw Exception when argument is a null reference [nullex]
  • Throw Exception when argument is white-space, the empty string or a null reference [nullwex]

Inserting codes in C# (Movie)

Description

In Visual Studio Static Code Analysis, all reference arguments that are passed to externally visible methods should be checked against null.

CA1062: Validate arguments of public methods

Use these snippets, to insert validation logic easily.

C#Visual Basic

Throw Exception when argument is the empty string or a null reference [nullempex]

Throw Exception when argument is a null reference [nullex]

Throw Exception when argument is white-space, the empty string or a null reference [nullwex]

Throw Exception when argument is the empty string or a null reference [nullempex]

Throw Exception when argument is a null reference [nullex]

Throw Exception when argument is white-space, the empty string or a null reference [nullwex]