C# Cheatsheets

[BASIC]

[CSHARP]

Add null to collection

Finds places where we add 'null' to a collection.

[BASIC]

[CSHARP]

Array access

Finds array access expressions with an index expression consisting of a unary increment or decrement, e.g. 'a[i++]'.

[BASIC]

[CSHARP]

Call to constructor

Finds places where we call 'new System.Exception(...)'.

[BASIC]

[CSHARP]

Call to method

Finds calls to method 'Company.Class.MethodName'.

[BASIC]

[CSHARP]

Cast expressions

Finds casts from a floating point type to an integer type.

[BASIC]

[CSHARP]

Catch exception

Finds places where we catch exceptions of type 'System.IO.IOException'.

[BASIC]

[CSHARP]

Class extends/implements

Finds classes/interfaces that extend/implement 'System.Collections.IEnumerator'.

[BASIC]

[CSHARP]

Conditional expression

Finds conditional expressions of the form '... ? ... : ...' where the types of the resulting expressions differ.

[BASIC]

[CSHARP]

Empty blocks

Finds empty block statements.

[BASIC]

[CSHARP]

Equality test on Boolean

Finds tests like 'x==true', 'x==false', 'x!=true', '!=false'.

[BASIC]

[CSHARP]

Expression qualifier

Finds qualified expressions (e.g. 'a.b()') and their qualifiers ('a').

[BASIC]

[CSHARP]

Extern methods

Finds methods that are 'extern'.

[BASIC]

[CSHARP]

Fields declared volatile

Finds fields with a 'volatile' modifier.

[BASIC]

[CSHARP]

Find-references links

Generates use-definition pairs that provide the data for find-references in the code viewer.

[BASIC]

[CSHARP]

If statements with empty then branch

Finds 'if' statements where the 'then' branch is an empty block statement

[BASIC]

[CSHARP]

Integer literal

Finds places where we use the integer literal '0'.

[BASIC]

[CSHARP]

Jump-to-definition links

Generates use-definition pairs that provide the data for jump-to-definition in the code viewer.

[BASIC]

[CSHARP]

Methods with many parameters

Finds methods with more than ten parameters.

[BASIC]

[CSHARP]

Methods without return type

Finds methods whose return type is 'void'.

[BASIC]

[CSHARP]

Mutual recursion

Finds pairs of methods that call each other.

[BASIC]

[CSHARP]

Override of method

Finds methods that directly override 'Object.ToString'.

[BASIC]

[CSHARP]

Print source code AST

Outputs a representation of a file's Abstract Syntax Tree. This query is used by the VS Code extension.

[BASIC]

[CSHARP]

Read of field

Finds reads of 'VirtualAddress' (defined on 'Mono.Cecil.PE.Section').

[BASIC]

[CSHARP]

Return statements

Finds return statements that return 'null'.

[BASIC]

[CSHARP]

Singleton blocks

Finds block statements containing a single statement.

[BASIC]

[CSHARP]

Switch statement case missing

Finds switch statements with a missing enum constant case and no default case.

[BASIC]

[CSHARP]

Throw exception of given type

Finds places where we throw 'System.IO.IOException' or one of its subtypes.

[BASIC]

[CSHARP]

TODO comments

Finds comments containing the word "TODO".

[BASIC]

[CSHARP]

Try-finally statements

Finds try-finally statements without a catch clause.

[BASIC]

[CSHARP]

Unused local variable

Finds local variables that are not accessed.

[BASIC]

[CSHARP]

Unused parameter

Finds parameters that are not accessed.