Skip to content

Commit

Permalink
Refactor: use SpecialType (#11)
Browse files Browse the repository at this point in the history
Context: https://learn.microsoft.com/dotnet/api/microsoft.codeanalysis.specialtype

I found the `SpecialType` property, I can use instead of comparing `string` values.
  • Loading branch information
jonathanpeppers committed Oct 30, 2023
1 parent 992b547 commit 2bc83bc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions MemoryAnalyzers/MemoryAnalyzers/MemoryAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ static bool IsDelegateType(INamedTypeSymbol type)
/// <summary>
/// Returns true if a type is exactly System.Object
/// </summary>
static bool IsObject(INamedTypeSymbol type) =>
type.ContainingNamespace.Name == "System" && type.Name == "Object";
static bool IsObject(INamedTypeSymbol type) => type.SpecialType == SpecialType.System_Object;

//Swiped from: https://www.meziantou.net/checking-if-a-property-is-an-auto-implemented-property-in-roslyn.htm
static bool IsAutoProperty(IPropertySymbol propertySymbol)
Expand Down

0 comments on commit 2bc83bc

Please sign in to comment.