diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs index 431a82703e74a738a2c85de679abc0ce5f27e7a1..2c2eebf476d36679bd661ffe7ab4734bb67d346b 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs @@ -865,29 +865,18 @@ public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol) public static ITypeSymbol GetSymbolType(this ISymbol symbol) { - if (symbol is ILocalSymbol localSymbol) - { - return localSymbol.Type; - } - - if (symbol is IFieldSymbol fieldSymbol) - { - return fieldSymbol.Type; - } - - if (symbol is IPropertySymbol propertySymbol) - { - return propertySymbol.Type; - } - - if (symbol is IParameterSymbol parameterSymbol) - { - return parameterSymbol.Type; - } - - if (symbol is IAliasSymbol aliasSymbol) + switch (symbol) { - return aliasSymbol.Target as ITypeSymbol; + case ILocalSymbol localSymbol: + return localSymbol.Type; + case IFieldSymbol fieldSymbol: + return fieldSymbol.Type; + case IPropertySymbol propertySymbol: + return propertySymbol.Type; + case IParameterSymbol parameterSymbol: + return parameterSymbol.Type; + case IAliasSymbol aliasSymbol: + return aliasSymbol.Target as ITypeSymbol; } return symbol as ITypeSymbol;