本文整理汇总了C#中ISymbol.IsAccessibleWithin方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.IsAccessibleWithin方法的具体用法?C# ISymbol.IsAccessibleWithin怎么用?C# ISymbol.IsAccessibleWithin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISymbol
的用法示例。
在下文中一共展示了ISymbol.IsAccessibleWithin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsOverridable
public bool IsOverridable(ISymbol member, INamedTypeSymbol containingType)
{
if (member.IsAbstract || member.IsVirtual || member.IsOverride)
{
if (member.IsSealed)
{
return false;
}
if (!member.IsAccessibleWithin(containingType))
{
return false;
}
switch (member.Kind)
{
case SymbolKind.Event:
return true;
case SymbolKind.Method:
return ((IMethodSymbol)member).MethodKind == MethodKind.Ordinary;
case SymbolKind.Property:
return !((IPropertySymbol)member).IsWithEvents;
}
}
return false;
}
示例2: IsInitializable
static bool IsInitializable (ISymbol member, INamedTypeSymbol containingType)
{
var propertySymbol = member as IPropertySymbol;
if (propertySymbol != null) {
if (propertySymbol.Parameters.Any (p => !p.IsOptional))
return false;
}
return
!member.IsStatic &&
member.MatchesKind (SymbolKind.Field, SymbolKind.Property) &&
member.IsAccessibleWithin (containingType);
}
示例3: IsInitializable
protected virtual bool IsInitializable(ISymbol member, INamedTypeSymbol containingType)
{
return
!member.IsStatic &&
member.MatchesKind(SymbolKind.Field, SymbolKind.Property) &&
member.IsAccessibleWithin(containingType);
}
示例4: IsAttributeNamedParameter
private static ISymbol IsAttributeNamedParameter(
ISymbol symbol,
ISymbol within)
{
if (!symbol.CanBeReferencedByName ||
!symbol.IsAccessibleWithin(within))
{
return null;
}
switch (symbol.Kind)
{
case SymbolKind.Field:
var fieldSymbol = (IFieldSymbol)symbol;
if (!fieldSymbol.IsConst &&
!fieldSymbol.IsReadOnly &&
!fieldSymbol.IsStatic)
{
return fieldSymbol;
}
break;
case SymbolKind.Property:
var propertySymbol = (IPropertySymbol)symbol;
if (!propertySymbol.IsReadOnly &&
!propertySymbol.IsWriteOnly &&
!propertySymbol.IsStatic &&
propertySymbol.GetMethod != null &&
propertySymbol.SetMethod != null &&
propertySymbol.GetMethod.IsAccessibleWithin(within) &&
propertySymbol.SetMethod.IsAccessibleWithin(within))
{
return propertySymbol;
}
break;
}
return null;
}
示例5: IsAccessible
private static bool IsAccessible(ISymbol symbol, INamedTypeSymbol within)
{
return within == null || symbol.IsAccessibleWithin(within);
}