Browse Source

Cache AssemblyReference.Name and AssemblyReference.FullName

pull/2643/head
Siegfried Pammer 3 years ago
parent
commit
04387d247c
  1. 35
      ICSharpCode.Decompiler/Metadata/AssemblyReferences.cs

35
ICSharpCode.Decompiler/Metadata/AssemblyReferences.cs

@ -222,29 +222,40 @@ namespace ICSharpCode.Decompiler.Metadata @@ -222,29 +222,40 @@ namespace ICSharpCode.Decompiler.Metadata
public bool IsWindowsRuntime => (entry.Flags & AssemblyFlags.WindowsRuntime) != 0;
public bool IsRetargetable => (entry.Flags & AssemblyFlags.Retargetable) != 0;
string? name;
string? fullName;
public string Name {
get {
try
{
return Metadata.GetString(entry.Name);
}
catch (BadImageFormatException)
if (name == null)
{
return $"AR:{Handle}";
try
{
name = Metadata.GetString(entry.Name);
}
catch (BadImageFormatException)
{
name = $"AR:{Handle}";
}
}
return name;
}
}
public string FullName {
get {
try
{
return entry.GetFullAssemblyName(Metadata);
}
catch (BadImageFormatException)
if (fullName == null)
{
return $"fullname(AR:{Handle})";
try
{
fullName = entry.GetFullAssemblyName(Metadata);
}
catch (BadImageFormatException)
{
fullName = $"fullname(AR:{Handle})";
}
}
return fullName;
}
}

Loading…
Cancel
Save