本文整理汇总了C#中IMethodSymbol.IsPublic方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodSymbol.IsPublic方法的具体用法?C# IMethodSymbol.IsPublic怎么用?C# IMethodSymbol.IsPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMethodSymbol
的用法示例。
在下文中一共展示了IMethodSymbol.IsPublic方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsImplicitCastOperator
private static bool IsImplicitCastOperator(IMethodSymbol method, Compilation compilation)
{
if (!method.IsStatic || !method.IsPublic())
return false;
return (method.Name == WellKnownMemberNames.ImplicitConversionName);
}
示例2: CheckDisposeSignatureRule
// CA1801: Remove unused parameters.
// TODO: Remove the below suppression once Roslyn bug https://github.com/dotnet/roslyn/issues/8884 is fixed.
#pragma warning disable CA1801
/// <summary>
/// Checks rule: Ensure that {0} is declared as public and sealed.
/// </summary>
private static void CheckDisposeSignatureRule(IMethodSymbol method, INamedTypeSymbol type, SymbolAnalysisContext context)
#pragma warning restore CA1801
{
if (!method.IsPublic() ||
method.IsAbstract || method.IsVirtual || (method.IsOverride && !method.IsSealed))
{
context.ReportDiagnostic(method.CreateDiagnostic(DisposeSignatureRule, $"{type.Name}.{method.Name}"));
}
}
示例3: IsEqualityOperator
private static bool IsEqualityOperator(IMethodSymbol method, Compilation compilation)
{
if (!method.IsStatic || !method.IsPublic())
return false;
switch (method.Name)
{
case WellKnownMemberNames.EqualityOperatorName:
case WellKnownMemberNames.InequalityOperatorName:
return true;
default:
return false;
}
}