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

Member predicate NonConstructedMethod::getAConstructingMethodOrSelf

Gets a method that either equals this non-constructed method, or a method that is a constructed version of this non-constructed method.

Note that this only relates to method type parameters and not to type parameters of enclosing types.

Example:

class A<T1> {
  void M1(T1 x1) { }
  void M2<T2>(T1 x1, T2 x) { }
}

class B {
  void M() {
    var c = new C<int>();
    c.M1(0);
    c.M2<string>(0, "");
  }
}

The unbound generic method of the call on line 10 is M1(int), whereas the unbound generic method of the call on line 11 is M2<T2>(int, T2).

Method getAConstructingMethodOrSelf()