From 024abb3ba6766a139d0d7aae736766c835fe2ad3 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 3 Nov 2017 17:08:06 +0100 Subject: [PATCH] CalculateFitness: In case of ctors use type name. --- ILSpy/SearchStrategies.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ILSpy/SearchStrategies.cs b/ILSpy/SearchStrategies.cs index a339b346b..8b7b760d2 100644 --- a/ILSpy/SearchStrategies.cs +++ b/ILSpy/SearchStrategies.cs @@ -39,16 +39,20 @@ namespace ICSharpCode.ILSpy protected float CalculateFitness(MemberReference member, string text) { // Probably compiler generated types without meaningful names, show them last - if (text.StartsWith("<")) - { + if (text.StartsWith("<")) { return 0; } + // Constructors always have the same name in IL: + // Use type name instead + if (text == "..ctor" || text == ".ctor") { + text = member.DeclaringType.Name; + } + // Ignore generic arguments, it not possible to search based on them either int length = 0; int generics = 0; - for (int i = 0; i < text.Length; i++) - { + for (int i = 0; i < text.Length; i++) { if (text[i] == '<') generics++; else if (text[i] == '>')