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


C# UsingDeclaration类代码示例

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


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

示例1: VisitUsingDeclaration

		public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
		{
			base.VisitUsingDeclaration(usingDeclaration, data);
			if (usingDeclaration.Parent is NamespaceDeclaration) {
				nodesToMoveToCompilationUnit.Add(usingDeclaration);
				RemoveCurrentNode();
			}
			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:9,代码来源:ToVBNetConvertVisitor.cs

示例2: HandleVisitorUsingDeclarationVisited

		void HandleVisitorUsingDeclarationVisited (UsingDeclaration node, InspectionData data)
		{
			if (!data.Graph.UsedUsings.Contains (node.Namespace)) {
				AddResult (data,
					new DomRegion (node.StartLocation.Line, node.StartLocation.Column, node.EndLocation.Line, node.EndLocation.Column),
					GettextCatalog.GetString ("Remove unused usings"),
					delegate {
						RefactoringOptions options = new RefactoringOptions () { Document = data.Document, Dom = data.Document.Dom};
						new RemoveUnusedImportsRefactoring ().Run (options);
					}
				);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:13,代码来源:UnusedUsingInspector.cs

示例3: VisitUsingDeclaration

 public override void VisitUsingDeclaration(UsingDeclaration usingDeclaration)
 {
     if (usingDeclaration.PrevSibling != null && !(usingDeclaration.PrevSibling is UsingDeclaration || usingDeclaration.PrevSibling is UsingAliasDeclaration)) {
         FixIndentationForceNewLine(usingDeclaration.StartLocation);
         EnsureBlankLinesBefore(usingDeclaration, policy.BlankLinesBeforeUsings);
     } else if (!(usingDeclaration.NextSibling is UsingDeclaration || usingDeclaration.NextSibling  is UsingAliasDeclaration)) {
         FixIndentationForceNewLine(usingDeclaration.StartLocation);
         EnsureBlankLinesAfter(usingDeclaration, policy.BlankLinesAfterUsings);
     } else {
         FixIndentationForceNewLine(usingDeclaration.StartLocation);
     }
 }
开发者ID:artifexor,项目名称:NRefactory,代码行数:12,代码来源:AstFormattingVisitor.cs

示例4: TrackedVisitUsingDeclaration

		public virtual object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
			return base.VisitUsingDeclaration(usingDeclaration, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NodeTrackingAstVisitor.cs

示例5: Visit

			public override void Visit (UsingsBag.Using u)
			{
				UsingDeclaration ud = new UsingDeclaration ();
				ud.AddChild (new CSharpTokenNode (Convert (u.UsingLocation), "using".Length), UsingDeclaration.Roles.Keyword);
				ud.AddChild (new Identifier (u.NSpace.Name, Convert (u.NSpace.Location)), UsingDeclaration.Roles.Identifier);
				ud.AddChild (new CSharpTokenNode (Convert (u.SemicolonLocation), 1), UsingDeclaration.Roles.Semicolon);
				AddToNamespace (ud);
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:8,代码来源:CSharpParser.cs

示例6: Visit

			public override void Visit(UsingNamespace un)
			{
				var ud = new UsingDeclaration();
				var loc = LocationsBag.GetLocations(un);
				ud.AddChild(new CSharpTokenNode(Convert(un.Location), UsingDeclaration.UsingKeywordRole), UsingDeclaration.UsingKeywordRole);
				if (un.NamespaceExpression != null)
					ud.AddChild(ConvertToType(un.NamespaceExpression), UsingDeclaration.ImportRole);
				if (loc != null)
					ud.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Semicolon), Roles.Semicolon);
				AddToNamespace(ud);
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:11,代码来源:CSharpParser.cs

示例7: VisitUsingDeclaration

 public virtual void VisitUsingDeclaration(UsingDeclaration usingDeclaration)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(usingDeclaration);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs

示例8: VisitUsingDeclaration

		public override void VisitUsingDeclaration(UsingDeclaration usingDeclaration)
		{
			if (!(usingDeclaration.PrevSibling is UsingDeclaration || usingDeclaration.PrevSibling  is UsingAliasDeclaration)) {
				EnsureBlankLinesBefore(usingDeclaration, policy.BlankLinesBeforeUsings);
			}
			if (!(usingDeclaration.NextSibling is UsingDeclaration || usingDeclaration.NextSibling  is UsingAliasDeclaration)) {
				EnsureBlankLinesAfter(usingDeclaration, policy.BlankLinesAfterUsings);
			}
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:9,代码来源:AstFormattingVisitor.cs

示例9: VisitUsingDeclaration

 public override void VisitUsingDeclaration(UsingDeclaration usingDeclaration)
 {
     imports.Add(usingDeclaration.GetText().Replace("using ", "").Replace(";\n", ""));
     base.VisitUsingDeclaration (usingDeclaration);
 }
开发者ID:renanalan,项目名称:101repo,代码行数:5,代码来源:Fact.cs

示例10: VisitUsingDeclaration

        public void VisitUsingDeclaration(UsingDeclaration usingDeclaration)
        {


            JsonObject declaration = new JsonObject();
            declaration.Comment = "VisitUsingDeclaration";
            AddKeyword(declaration, UsingDeclaration.UsingKeywordRole);
            declaration.AddJsonValue("import", GenerateNamespaceString(usingDeclaration.Import));

            Push(declaration);
        }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:11,代码来源:AstCsToJson.cs

示例11: VisitDeclareDeclaration

		public override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
		{
			if (usings != null && !usings.ContainsKey("System.Runtime.InteropServices")) {
				UsingDeclaration @using = new UsingDeclaration("System.Runtime.InteropServices");
				addedUsings.Add(@using);
				base.VisitUsingDeclaration(@using, data);
			}
			
			MethodDeclaration method = new MethodDeclaration {
				Name = declareDeclaration.Name,
				Modifier = declareDeclaration.Modifier,
				TypeReference = declareDeclaration.TypeReference,
				Parameters = declareDeclaration.Parameters,
				Attributes = declareDeclaration.Attributes
			};
			
			if ((method.Modifier & Modifiers.Visibility) == 0)
				method.Modifier |= Modifiers.Public;
			method.Modifier |= Modifiers.Extern | Modifiers.Static;
			
			if (method.TypeReference.IsNull) {
				method.TypeReference = new TypeReference("System.Void", true);
			}
			
			Attribute att = new Attribute("DllImport", null, null);
			att.PositionalArguments.Add(CreateStringLiteral(declareDeclaration.Library));
			if (declareDeclaration.Alias.Length > 0) {
				att.NamedArguments.Add(new NamedArgumentExpression("EntryPoint", CreateStringLiteral(declareDeclaration.Alias)));
			}
			switch (declareDeclaration.Charset) {
				case CharsetModifier.Auto:
					att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
					                                                   new MemberReferenceExpression(new IdentifierExpression("CharSet"),
					                                                                                 "Auto")));
					break;
				case CharsetModifier.Unicode:
					att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
					                                                   new MemberReferenceExpression(new IdentifierExpression("CharSet"),
					                                                                                 "Unicode")));
					break;
				default:
					att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
					                                                   new MemberReferenceExpression(new IdentifierExpression("CharSet"),
					                                                                                 "Ansi")));
					break;
			}
			att.NamedArguments.Add(new NamedArgumentExpression("SetLastError", new PrimitiveExpression(true, true.ToString())));
			att.NamedArguments.Add(new NamedArgumentExpression("ExactSpelling", new PrimitiveExpression(true, true.ToString())));
			method.Attributes.Add(new AttributeSection { Attributes = { att } });
			ReplaceCurrentNode(method);
			return base.VisitMethodDeclaration(method, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:52,代码来源:VBNetConstructsConvertVisitor.cs

示例12: VisitUsingDeclaration

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

示例13: VisitUsingDeclaration

		public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
			throw new global::System.NotImplementedException("UsingDeclaration");
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NotImplementedAstVisitor.cs

示例14: UsingDirective

 private void UsingDirective()
 {
     string qualident = null;
     TypeReference type = null;
     base.Expect(120);
     Point location = this.t.Location;
     this.Qualident(out qualident);
     if (this.la.kind == 3)
     {
         base.lexer.NextToken();
         this.NonArrayType(out type);
     }
     base.Expect(11);
     if ((qualident != null) && (qualident.Length > 0))
     {
         INode node;
         if (type != null)
         {
             node = new UsingDeclaration(qualident, type);
         }
         else
         {
             node = new UsingDeclaration(qualident);
         }
         node.StartLocation = location;
         node.EndLocation = this.t.EndLocation;
         base.compilationUnit.AddChild(node);
     }
 }
开发者ID:KnowNo,项目名称:test-code-backup,代码行数:29,代码来源:Parser.cs

示例15: VisitUsingDeclaration

		public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
			Debug.Assert((usingDeclaration != null));
			Debug.Assert((usingDeclaration.Usings != null));
			for (int i = 0; i < usingDeclaration.Usings.Count; i++) {
				Using o = usingDeclaration.Usings[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (Using)nodeStack.Pop();
				if (o == null)
					usingDeclaration.Usings.RemoveAt(i--);
				else
					usingDeclaration.Usings[i] = o;
			}
			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:16,代码来源:AbstractAstTransformer.cs


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