Repository: dotnet/roslyn
File: src/Compilers/CSharp/Portable/Symbols/MemberSymbolExtensions.cs (C#)

Code before:
                    return ((MethodSymbol)member).ParameterTypesWithAnnotations;
                case SymbolKind.Property:
                    return ((PropertySymbol)member).ParameterTypesWithAnnotations;
                case SymbolKind.Event:
                    return ImmutableArray<TypeWithAnnotations>.Empty;
                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind);
            }
        }

        internal static bool GetIsVararg(this Symbol member)
        {
            switch (member.Kind)
            {
                case SymbolKind.Method:
                    return ((MethodSymbol)member).IsVararg;
                case SymbolKind.Property:
                case SymbolKind.Event:
                    return false;
                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind);
            }
        }

#nullable enable
        internal static bool GetIsNewExtensionMember(this Symbol member)
        {
            switch (member.Kind)
            {
                case SymbolKind.Method:
                    return GetIsNewExtensionMember((MethodSymbol)member);
                case SymbolKind.Property:
                    return GetIsNewExtensionMember((PropertySymbol)member);
                default:
                    return false;
            }
        }

        internal static bool GetIsNewExtensionMember(this MethodSymbol member)
        {
            return member is { ContainingSymbol: NamedTypeSymbol { IsExtension: true }, OriginalDefinition: not SynthesizedExtensionMarker };
        }

        internal static bool GetIsNewExtensionMember(this PropertySymbol member)
        {
            return member.ContainingSymbol is NamedTypeSymbol { IsExtension: true };
        }

        internal static bool TryGetInstanceExtensionParameter(this Symbol symbol, [NotNullWhen(true)] out ParameterSymbol? extensionParameter)
        {
            if (symbol is not null

Review comment (refactor):
nit: We could even switch those helpers to be properties, which would go well with `IsExtension` and `IsExtensionMethod`

Code after:
                    return ((MethodSymbol)member).ParameterTypesWithAnnotations;
                case SymbolKind.Property:
                    return ((PropertySymbol)member).ParameterTypesWithAnnotations;
                case SymbolKind.Event:
                    return ImmutableArray<TypeWithAnnotations>.Empty;
                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind);
            }
        }

        internal static bool GetIsVararg(this Symbol member)
        {
            switch (member.Kind)
            {
                case SymbolKind.Method:
                    return ((MethodSymbol)member).IsVararg;
                case SymbolKind.Property:
                case SymbolKind.Event:
                    return false;
                default:
                    throw ExceptionUtilities.UnexpectedValue(member.Kind);
            }
        }

#nullable enable
        internal static bool IsExtensionBlockMember(this Symbol member)
        {
            switch (member.Kind)
            {
                case SymbolKind.Method:
                    return IsExtensionBlockMember((MethodSymbol)member);
                case SymbolKind.Property:
                    return IsExtensionBlockMember((PropertySymbol)member);
                default:
                    return false;
            }
        }

        internal static bool IsExtensionBlockMember(this MethodSymbol member)
        {
            return member is { ContainingSymbol: NamedTypeSymbol { IsExtension: true }, OriginalDefinition: not SynthesizedExtensionMarker };
        }

        internal static bool IsExtensionBlockMember(this PropertySymbol member)
        {
            return member.ContainingSymbol is NamedTypeSymbol { IsExtension: true };
        }

        internal static bool TryGetInstanceExtensionParameter(this Symbol symbol, [NotNullWhen(true)] out ParameterSymbol? extensionParameter)
        {
            if (symbol is not null