CodeQL library for C#
codeql/csharp-all 0.9.2-dev (changelog, source)
Search

Predicate getAPossibleImplementor

Gets a class or struct that may implement (parts of) the members of the interface i. Note that the class or struct need not be a sub type of the interface in the inheritance hierarchy:

interface I { void M(); }

class A { public void M() { } }

class B { }

class C : B, I { }

All classes A, B, and C may implement some of the members of I (in this example, though, only A actually does), even though only C is a sub type of I.

Import path

import semmle.code.csharp.Implements
ValueOrRefType getAPossibleImplementor(Interface i)