当前位置: 首页>>代码示例>>C#>>正文


C# TypeParameterDeclaration类代码示例

本文整理汇总了C#中TypeParameterDeclaration的典型用法代码示例。如果您正苦于以下问题:C# TypeParameterDeclaration类的具体用法?C# TypeParameterDeclaration怎么用?C# TypeParameterDeclaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeParameterDeclaration类属于命名空间,在下文中一共展示了TypeParameterDeclaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitTypeParameterDeclaration

			public override void VisitTypeParameterDeclaration (TypeParameterDeclaration decl)
			{
				base.VisitTypeParameterDeclaration (decl);

				var resolveResult = ctx.Resolve (decl) as TypeResolveResult;
				if (resolveResult == null)
					return;
				var typeParameter = resolveResult.Type as ITypeParameter;
				if (typeParameter == null)
					return;
				var methodDecl = decl.Parent as MethodDeclaration;
				if (methodDecl == null)
					return;

				if (FindUsage (ctx, unit, typeParameter, decl))
					return;

				AddIssue (decl.NameToken, ctx.TranslateString ("Type parameter is never used"));
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:19,代码来源:TypeParameterNotUsedIssue.cs

示例2: VisitTypeParameterDeclaration

		public void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration)
		{
			StartNode(typeParameterDeclaration);
			WriteAttributes(typeParameterDeclaration.Attributes);
			switch (typeParameterDeclaration.Variance) {
				case VarianceModifier.Invariant:
					break;
				case VarianceModifier.Covariant:
					WriteKeyword(TypeParameterDeclaration.OutVarianceKeywordRole);
					break;
				case VarianceModifier.Contravariant:
					WriteKeyword(TypeParameterDeclaration.InVarianceKeywordRole);
					break;
				default:
					throw new NotSupportedException ("Invalid value for VarianceModifier");
			}
			typeParameterDeclaration.NameToken.AcceptVisitor(this);
			EndNode(typeParameterDeclaration);
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:19,代码来源:CSharpOutputVisitor.cs

示例3: VisitTypeParameterDeclaration

		public virtual void VisitTypeParameterDeclaration (TypeParameterDeclaration typeParameterDeclaration)
		{
			VisitChildren (typeParameterDeclaration);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs

示例4: AddTypeParameters

			void AddTypeParameters(AstNode parent, MemberName memberName)
			{
				if (memberName == null || memberName.TypeParameters == null)
					return;
				var chevronLocs = LocationsBag.GetLocations(memberName.TypeParameters);
				if (chevronLocs != null)
					parent.AddChild(new CSharpTokenNode(Convert(chevronLocs [chevronLocs.Count - 2]), Roles.LChevron), Roles.LChevron);
				for (int i = 0; i < memberName.TypeParameters.Count; i++) {
					if (chevronLocs != null && i > 0 && i - 1 < chevronLocs.Count)
						parent.AddChild(new CSharpTokenNode(Convert(chevronLocs [i - 1]), Roles.Comma), Roles.Comma);
					var arg = memberName.TypeParameters [i];
					if (arg == null)
						continue;
					var tp = new TypeParameterDeclaration();
					
					List<Location> varianceLocation;
					switch (arg.Variance) {
						case Variance.Contravariant:
							tp.Variance = VarianceModifier.Contravariant;
							varianceLocation = LocationsBag.GetLocations(arg);
							if (varianceLocation != null)
								tp.AddChild(new CSharpTokenNode(Convert(varianceLocation [0]), TypeParameterDeclaration.InVarianceKeywordRole), TypeParameterDeclaration.InVarianceKeywordRole);
							break;
						case Variance.Covariant:
							tp.Variance = VarianceModifier.Covariant;
							varianceLocation = LocationsBag.GetLocations(arg);
							if (varianceLocation != null)
								tp.AddChild(new CSharpTokenNode(Convert(varianceLocation [0]), TypeParameterDeclaration.OutVarianceKeywordRole), TypeParameterDeclaration.OutVarianceKeywordRole);
							break;
						default:
							tp.Variance = VarianceModifier.Invariant;
							break;
							
					}
					
					AddAttributeSection(tp, arg.OptAttributes);

					switch (arg.Variance) {
						case Variance.Covariant:
							tp.Variance = VarianceModifier.Covariant;
							break;
						case Variance.Contravariant:
							tp.Variance = VarianceModifier.Contravariant;
							break;
					}
					tp.AddChild(Identifier.Create(arg.Name, Convert(arg.Location)), Roles.Identifier);
					parent.AddChild(tp, Roles.TypeParameter);
				}
				if (chevronLocs != null)
					parent.AddChild(new CSharpTokenNode(Convert(chevronLocs [chevronLocs.Count - 1]), Roles.RChevron), Roles.RChevron);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:51,代码来源:CSharpParser.cs

示例5: AddTypeParameters

			void AddTypeParameters (AstNode parent, Mono.CSharp.TypeArguments typeArguments)
			{
				if (typeArguments == null || typeArguments.IsEmpty)
					return;
				var chevronLocs = LocationsBag.GetLocations (typeArguments);
				if (chevronLocs != null)
					parent.AddChild (new CSharpTokenNode (Convert (chevronLocs[chevronLocs.Count - 2]), 1), InvocationExpression.Roles.LChevron);
				for (int i = 0; i < typeArguments.Count; i++) {
					if (chevronLocs != null && i > 0 && i - 1 < chevronLocs.Count)
						parent.AddChild (new CSharpTokenNode (Convert (chevronLocs[i - 1]), 1), InvocationExpression.Roles.Comma);
					var arg = (TypeParameterName)typeArguments.Args[i];
					if (arg == null)
						continue;
					TypeParameterDeclaration tp = new TypeParameterDeclaration();
					
					List<Location> varianceLocation;
					switch (arg.Variance) {
					case Variance.Contravariant:
						tp.Variance = VarianceModifier.Contravariant;
						varianceLocation = LocationsBag.GetLocations (arg);
						if (varianceLocation != null)
							tp.AddChild (new CSharpTokenNode (Convert (varianceLocation[0]), "out".Length), TypeParameterDeclaration.VarianceRole);
						break;
					case Variance.Covariant:
						tp.Variance = VarianceModifier.Covariant;
						varianceLocation = LocationsBag.GetLocations (arg);
						if (varianceLocation != null)
							tp.AddChild (new CSharpTokenNode (Convert (varianceLocation[0]), "out".Length), TypeParameterDeclaration.VarianceRole);
						break;
					default:
						tp.Variance = VarianceModifier.Invariant;
						break;
						
					}
					
					AddAttributeSection (tp, arg.OptAttributes);

					switch (arg.Variance) {
						case Variance.Covariant:
							tp.Variance = VarianceModifier.Covariant;
							break;
						case Variance.Contravariant:
							tp.Variance = VarianceModifier.Contravariant;
							break;
					}
					tp.AddChild (Identifier.Create (arg.Name, Convert (arg.Location)), InvocationExpression.Roles.Identifier);
					parent.AddChild (tp, InvocationExpression.Roles.TypeParameter);
				}
				if (chevronLocs != null)
					parent.AddChild (new CSharpTokenNode (Convert (chevronLocs[chevronLocs.Count - 1]), 1), InvocationExpression.Roles.RChevron);
			}
开发者ID:N3X15,项目名称:ILSpy,代码行数:51,代码来源:CSharpParser.cs

示例6: HandleVisitorTypeParameterDeclarationVisited

		void HandleVisitorTypeParameterDeclarationVisited (TypeParameterDeclaration node, InspectionData data)
		{
			foreach (var rule in policy.Rules) {
				if (rule.CheckTypeParameter (node, data))
					return;
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:NamingInspector.cs

示例7: AddTypeParameters

			void AddTypeParameters (AstNode parent, List<Location> location, Mono.CSharp.TypeArguments typeArguments)
			{
				if (typeArguments == null || typeArguments.IsEmpty)
					return;
				for (int i = 0; i < typeArguments.Count; i++) {
					if (location != null && i > 0 && i - 1 < location.Count)
						parent.AddChild (new CSharpTokenNode (Convert (location[i - 1]), 1), InvocationExpression.Roles.Comma);
					var arg = (TypeParameterName)typeArguments.Args[i];
					if (arg == null)
						continue;
					TypeParameterDeclaration tp = new TypeParameterDeclaration();
					// TODO: attributes
					switch (arg.Variance) {
						case Variance.Covariant:
							tp.Variance = VarianceModifier.Covariant;
							break;
						case Variance.Contravariant:
							tp.Variance = VarianceModifier.Contravariant;
							break;
					}
					tp.AddChild (Identifier.Create (arg.Name, Convert (arg.Location)), InvocationExpression.Roles.Identifier);
					parent.AddChild (tp, InvocationExpression.Roles.TypeParameter);
				}
			}
开发者ID:aleksandersumowski,项目名称:monodevelop,代码行数:24,代码来源:CSharpParser.cs

示例8: ConvertTypeParameter

 TypeParameterDeclaration ConvertTypeParameter(ITypeParameter tp)
 {
     TypeParameterDeclaration decl = new TypeParameterDeclaration();
     decl.Variance = tp.Variance;
     decl.Name = tp.Name;
     return decl;
 }
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:7,代码来源:TypeSystemAstBuilder.cs

示例9: VisitTypeParameterDeclaration

			public override void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration)
			{
				base.VisitTypeParameterDeclaration(typeParameterDeclaration);
				CheckNamedResolveResult(null, typeParameterDeclaration, AffectedEntity.TypeParameter, typeParameterDeclaration.NameToken, Modifiers.None);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:5,代码来源:InconsistentNamingIssue.cs

示例10: MakeTypeParameters

		IEnumerable<TypeParameterDeclaration> MakeTypeParameters(IEnumerable<GenericParameter> genericParameters)
		{
			foreach (var gp in genericParameters) {
				TypeParameterDeclaration tp = new TypeParameterDeclaration();
				tp.Name = CleanName(gp.Name);
				if (gp.IsContravariant)
					tp.Variance = VarianceModifier.Contravariant;
				else if (gp.IsCovariant)
					tp.Variance = VarianceModifier.Covariant;
				ConvertCustomAttributes(tp, gp);
				yield return tp;
			}
		}
开发者ID:eldersantos,项目名称:ILSpy,代码行数:13,代码来源:AstBuilder.cs

示例11: AddTypeParameters

			void AddTypeParameters (AstNode parent, List<Location> location, Mono.CSharp.TypeArguments typeArguments)
			{
				if (typeArguments == null || typeArguments.IsEmpty)
					return;
				for (int i = 0; i < typeArguments.Count; i++) {
					if (location != null && i > 0 && i - 1 < location.Count)
						parent.AddChild (new CSharpTokenNode (Convert (location[i - 1]), 1), InvocationExpression.Roles.Comma);
					var arg = (TypeParameterName)typeArguments.Args[i];
					if (arg == null)
						continue;
					TypeParameterDeclaration tp = new TypeParameterDeclaration();
					// TODO: attributes
					if (arg.Variance != Variance.None)
						throw new NotImplementedException(); // TODO: variance
					tp.AddChild (new Identifier (arg.Name, Convert (arg.Location)), InvocationExpression.Roles.Identifier);
					parent.AddChild (tp, InvocationExpression.Roles.TypeParameter);
				}
			}
开发者ID:madkat,项目名称:NRefactory,代码行数:18,代码来源:CSharpParser.cs

示例12: ConvertTypeParameter

 TypeParameterDeclaration ConvertTypeParameter(ITypeParameter tp)
 {
     TypeParameterDeclaration decl = new TypeParameterDeclaration();
     decl.Variance = tp.Variance;
     decl.Name = tp.Name;
     if (ShowAttributes)
         decl.Attributes.AddRange (tp.Attributes.Select ((a) => new AttributeSection (ConvertAttribute (a))));
     return decl;
 }
开发者ID:yyp2003net,项目名称:NRefactory,代码行数:9,代码来源:TypeSystemAstBuilder.cs

示例13: VisitTypeParameterDeclaration

        public void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration)
        {
            JsonObject declaration = new JsonObject();
            declaration.Comment = "VisitTypeParameterDeclaration";
            declaration.AddJsonValue("attributes", GetAttributes(typeParameterDeclaration.Attributes));
            switch (typeParameterDeclaration.Variance)
            {
                case VarianceModifier.Invariant:
                    break;
                case VarianceModifier.Covariant:
                    declaration.AddJsonValue("keyword", GetKeyword(TypeParameterDeclaration.OutVarianceKeywordRole));
                    break;
                case VarianceModifier.Contravariant:
                    declaration.AddJsonValue("keyword", GetKeyword(TypeParameterDeclaration.InVarianceKeywordRole));
                    break;
                default:
                    throw new NotSupportedException("Invalid value for VarianceModifier");
            }
            declaration.AddJsonValue("identifier", GetIdentifier(typeParameterDeclaration.NameToken));

            Push(declaration);

        }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:23,代码来源:AstCsToJson.cs

示例14: VisitTypeParameterDeclaration

 public void VisitTypeParameterDeclaration(TypeParameterDeclaration node)
 {
     VisitChildren(node);
 }
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs

示例15: VisitTypeParameterDeclaration

 public virtual void VisitTypeParameterDeclaration(TypeParameterDeclaration typeParameterDeclaration)
 {
     //throw this.CreateException(typeParameterDeclaration);
 }
开发者ID:txdv,项目名称:Builder,代码行数:4,代码来源:Visitor.Empty.cs


注:本文中的TypeParameterDeclaration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。