CodeQL library for C#
codeql/csharp-all 0.4.4 (changelog, source)

Predicate designedForChaining

Holds if callable c is designed for chaining. The following must be fulfilled:

  • c must be declared in a reference type.
  • All callables overriding c must be designed for chaining.
  • If c has a body, all (and at least one) returned values must be this.
  • If c has no body (abstract/interface callable or library callable), the return type of c must be a subtype of c’s declaring type, and c must be non-static.

Import path

import semmle.code.csharp.Chaining
predicate designedForChaining(Callable c)