本文整理汇总了C#中ICSharpCode.Annotation方法的典型用法代码示例。如果您正苦于以下问题:C# ICSharpCode.Annotation方法的具体用法?C# ICSharpCode.Annotation怎么用?C# ICSharpCode.Annotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode
的用法示例。
在下文中一共展示了ICSharpCode.Annotation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTypeKindForAstType
public TypeKind GetTypeKindForAstType(ICSharpCode.NRefactory.CSharp.AstType type) {
var annotation = type.Annotation<ITypeDefOrRef>();
if (annotation == null)
return TypeKind.Unknown;
var definition = annotation.ResolveTypeDef();
if (definition == null)
return TypeKind.Unknown;
if (definition.IsClass)
return TypeKind.Class;
if (definition.IsInterface)
return TypeKind.Interface;
if (definition.IsEnum)
return TypeKind.Enum;
if (definition.IsValueType)
return TypeKind.Struct;
return TypeKind.Unknown;
}
示例2: GetTypeKindForAstType
public TypeKind GetTypeKindForAstType(ICSharpCode.NRefactory.CSharp.AstType type)
{
var annotation = type.Annotation<TypeReference>();
if (annotation == null)
return TypeKind.Unknown;
var definition = annotation.ResolveOrThrow();
if (definition.IsClass)
return TypeKind.Class;
if (definition.IsInterface)
return TypeKind.Interface;
if (definition.IsEnum)
return TypeKind.Enum;
if (definition.IsFunctionPointer)
return TypeKind.Delegate;
if (definition.IsValueType)
return TypeKind.Struct;
return TypeKind.Unknown;
}
示例3: IsMethodGroup
public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression)
{
var annotation = expression.Annotation<MethodDef>();
if (annotation != null) {
return true;
}
return false;
}
示例4: IsMethodGroup
public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression)
{
var annotation = expression.Annotation<MethodDefinition>();
if (annotation != null && annotation.SemanticsAttributes == MethodSemanticsAttributes.None)
{
return true;
}
return false;
}
示例5: GetParametersForProperty
public ICSharpCode.NRefactory.CSharp.ParameterDeclaration[] GetParametersForProperty(ICSharpCode.NRefactory.CSharp.PropertyDeclaration property) {
var propInfo = property.Annotation<PropertyDef>();
if (propInfo == null)
return new ICSharpCode.NRefactory.CSharp.ParameterDeclaration[0];
sb.Clear();
var getMethod = propInfo.GetMethod;
if (getMethod != null)
return getMethod.Parameters.Where(p => p.IsNormalMethodParameter).Select(p => new ICSharpCode.NRefactory.CSharp.ParameterDeclaration(AstBuilder.ConvertType(p.Type, sb), p.Name, GetModifiers(p))).ToArray();
var setMethod = propInfo.SetMethod;
if (setMethod != null) {
var ps = setMethod.Parameters.Where(p => p.IsNormalMethodParameter).ToArray();
if (ps.Length > 1)
return ps.Take(ps.Length - 1).Select(p => new ICSharpCode.NRefactory.CSharp.ParameterDeclaration(AstBuilder.ConvertType(p.Type, sb), p.Name, GetModifiers(p))).ToArray();
}
return new ICSharpCode.NRefactory.CSharp.ParameterDeclaration[0];
}
示例6: IsMethodGroup
public bool IsMethodGroup(ICSharpCode.NRefactory.CSharp.Expression expression) {
var annotation = expression.Annotation<MethodDef>();
if (annotation == null)
return false;
return expression.Annotation<PropertyDef>() == null && expression.Annotation<EventDef>() == null;
}
示例7: HasEvent
public bool HasEvent(ICSharpCode.NRefactory.VB.Ast.Expression expression) => expression.Annotation<EventDef>() != null;