Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Compilers/Core/Portable/Symbols/IMethodSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ public interface IMethodSymbol : ISymbol
bool IsGenericMethod { get; }

/// <summary>
/// Returns true if this method is an extension method.
/// Returns true if this method is a "classic" extension method (using the <see langword="this"/>
/// modifier in C# or <see cref="System.Runtime.CompilerServices.ExtensionAttribute"/> in VB).
/// </summary>
/// <remarks>
/// Returns false for methods in <c>extension()</c> blocks.
/// To check if a method is a "new" extension method (a member of an <c>extension()</c> block),
/// check <see cref="ITypeSymbol.IsExtension"/> on the method's <see cref="ISymbol.ContainingType"/>.
/// </remarks>
bool IsExtensionMethod { get; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public static bool IsReducedExtension([NotNullWhen(true)] this ISymbol? symbol)
public static bool IsEnumMember([NotNullWhen(true)] this ISymbol? symbol)
=> symbol is { Kind: SymbolKind.Field, ContainingType.TypeKind: TypeKind.Enum };

/// <inheritdoc cref="IMethodSymbol.IsExtensionMethod"/>
public static bool IsExtensionMethod(this ISymbol symbol)
=> symbol is IMethodSymbol { IsExtensionMethod: true };

Expand Down