Enable assembly defaults, update analyzer
このコミットが含まれているのは:
1 親
dd8f221905
コミット
e5daf558ec
10ファイル変更
+217
-71
検索条件に一致するファイルはありません
@@ -27,6 +27,30 @@ internal static class ISymbolExtensions
|
||||
return symbol.ToDisplayString(FullyQualifiedWithoutGlobalFormat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get an attribute with the specified type.
|
||||
/// </summary>
|
||||
/// <param name="symbol">The input <see cref="ISymbol"/> instance to check.</param>
|
||||
/// <param name="typeSymbol">The <see cref="ITypeSymbol"/> instance for the attribute type to look for.</param>
|
||||
/// <param name="attributeData">The resulting attribute, if it was found.</param>
|
||||
/// <returns>Whether or not <paramref name="symbol"/> has an attribute with the specified name.</returns>
|
||||
public static bool TryGetAttributeWithType(this ISymbol symbol, ITypeSymbol typeSymbol, [NotNullWhen(true)] out AttributeData? attributeData)
|
||||
{
|
||||
foreach (AttributeData attribute in symbol.GetAttributes())
|
||||
{
|
||||
if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, typeSymbol))
|
||||
{
|
||||
attributeData = attribute;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
attributeData = null;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get an attribute with the specified fully qualified metadata name.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする