lundi 21 novembre 2016

Get all extension methods for type by use roslyn api

I want get all extensions methods for type. For example for type "string" if i'am use semanticmodel method lookupsymbols

var sourceText = @"string a = "";
a."
var tree= CSharpSyntaxTree.ParseText(sourceTextx...);
....
var members = semanticModel.LookupSymbols(source.IndexOf("a."), someType, includeReducedExtensionMethods: true);
//this return all members with extension methods for type string someExtMethod(this string text)....


//I want get all extension with methods where first param might be one of them 
var interfaces = someType.AllInerfaces;
//for example IEnumerable<out T>, methods like: Select, Where, Aggregate...





Aucun commentaire:

Enregistrer un commentaire