Browse Source

Fix incorrect display of constructors in tree view.

pull/1213/head
Siegfried Pammer 7 years ago
parent
commit
23f118ac93
  1. 10
      ILSpy/Languages/CSharpLanguage.cs
  2. 2
      ILSpy/Languages/Language.cs

10
ILSpy/Languages/CSharpLanguage.cs

@ -502,18 +502,18 @@ namespace ICSharpCode.ILSpy @@ -502,18 +502,18 @@ namespace ICSharpCode.ILSpy
if (method == null)
throw new ArgumentNullException(nameof(method));
string name;
if (method.IsConstructor) {
name = TypeToString(method.DeclaringTypeDefinition, includeNamespace: includeNamespaceOfDeclaringTypeName);
} else {
if (includeDeclaringTypeName) {
name = TypeToString(method.DeclaringTypeDefinition, includeNamespace: includeNamespaceOfDeclaringTypeName) + ".";
} else {
name = "";
}
if (method.IsConstructor) {
name += TypeToString(method.DeclaringTypeDefinition, false);
} else {
name += method.Name;
}
int i = 0;
var buffer = new System.Text.StringBuilder(name);
var buffer = new StringBuilder(name);
if (method.TypeParameters.Count > 0) {
buffer.Append('<');
@ -537,8 +537,10 @@ namespace ICSharpCode.ILSpy @@ -537,8 +537,10 @@ namespace ICSharpCode.ILSpy
}
buffer.Append(')');
if (!method.IsConstructor) {
buffer.Append(" : ");
buffer.Append(TypeToStringInternal(method.ReturnType, includeNamespace));
}
return buffer.ToString();
}

2
ILSpy/Languages/Language.cs

@ -221,8 +221,10 @@ namespace ICSharpCode.ILSpy @@ -221,8 +221,10 @@ namespace ICSharpCode.ILSpy
i++;
}
buffer.Append(')');
if (!method.IsConstructor) {
buffer.Append(" : ");
buffer.Append(TypeToString(method.ReturnType, includeNamespace));
}
return buffer.ToString();
}

Loading…
Cancel
Save