本文整理汇总了C#中ISymbol.IsType方法的典型用法代码示例。如果您正苦于以下问题:C# ISymbol.IsType方法的具体用法?C# ISymbol.IsType怎么用?C# ISymbol.IsType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISymbol
的用法示例。
在下文中一共展示了ISymbol.IsType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsDisqualifyingMember
/// <summary>
/// Returns a value indicating whether the presence of the specified symbol
/// disqualifies a class from being considered a static holder class.
/// </summary>
/// <param name="member">
/// The member being examined.
/// </param>
/// <returns>
/// <c>true</c> if the presence of <paramref name="member"/> disqualifies the
/// current type as a static holder class; otherwise <c>false</c>.
/// </returns>
private static bool IsDisqualifyingMember(ISymbol member)
{
// An user-defined operator method disqualifies a class from being considered
// a static holder, because even though it is static, it takes instances as
// parameters, so presumably the author of the class intended for it to be
// instantiated.
if (member.IsUserDefinedOperator())
{
return true;
}
// A type member does *not* disqualify a class from being considered a static
// holder, because even though it is *not* static, it is nevertheless not
// per-instance.
if (member.IsType())
{
return false;
}
// Any instance member other than a default constructor disqualifies a class
// from being considered a static holder class.
return !member.IsStatic && !member.IsDefaultConstructor();
}
示例2: IsQualifyingMember
/// <summary>
/// Returns a value indicating whether the specified symbol qualifies as a
/// member of a static holder class.
/// </summary>
/// <param name="member">
/// The member being examined.
/// </param>
/// <returns>
/// <c>true</c> if <paramref name="member"/> qualifies as a member of
/// a static holder class; otherwise <c>false</c>.
/// </returns>
private static bool IsQualifyingMember(ISymbol member)
{
// A type member *does* qualify as a member of a static holder class,
// because even though it is *not* static, it is nevertheless not
// per-instance.
if (member.IsType())
{
return true;
}
// An user-defined operator method is not a valid member of a static holder
// class, because even though it is static, it takes instances as
// parameters, so presumably the author of the class intended for it to be
// instantiated.
if (member.IsUserDefinedOperator())
{
return false;
}
return member.IsStatic;
}