• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TypeDeclaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: VisitTypeDeclaration

			public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
			{
				bool oldIsSealedType = isSealedType;
				isSealedType = typeDeclaration.Modifiers.HasFlag(Modifiers.Sealed);
				base.VisitTypeDeclaration(typeDeclaration);
				isSealedType = oldIsSealedType;
			}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:7,代码来源:CallToVirtualFunctionFromConstructorIssue.cs


示例2: VisitTypeDeclaration

        public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            if (!typeDeclaration.HasModifier(Modifiers.Public))
            {
                base.VisitTypeDeclaration(typeDeclaration);
                return;
            }

            this.m_TotalClasses++;
            if (this.m_TotalClasses > 1)
            {
                this.Results.Issues.Add(new LintIssue(typeDeclaration)
                {
                    Index = LintIssueIndex.MoreThanOneClassInFile,
                    Parameters = new[]
                    {
                        typeDeclaration.Name,
                        this.m_FirstClassName
                    }
                });
            }
            else
            {
                this.m_FirstClassName = typeDeclaration.Name;
            }

            base.VisitTypeDeclaration(typeDeclaration);
        }
开发者ID:ow-pastuch,项目名称:cstools,代码行数:28,代码来源:EnsureOnePublicClassPerFilePolicy.cs


示例3: GetAllPMixinAttributes

 public static IEnumerable<pMixinAttributeResolvedResult> GetAllPMixinAttributes(
     this ICreateCodeGenerationPlanPipelineState manager,
     TypeDeclaration target)
 {
     return manager.ResolveAttributesPipeline.PartialClassLevelResolvedPMixinAttributes[target]
         .OfType<pMixinAttributeResolvedResult>();
 }
开发者ID:prescottadam,项目名称:pMixins,代码行数:7,代码来源:ICreateCodeGenerationPlanPipelineState.cs


示例4: VisitTypeDeclaration

		public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
		{
			Push();
			object result = base.VisitTypeDeclaration(typeDeclaration, data);
			Pop();
			return result;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:PrefixFieldsVisitor.cs


示例5: CheckName

			void CheckName(TypeDeclaration node, AffectedEntity entity, Identifier identifier, Modifiers accessibilty)
			{
				TypeResolveResult resolveResult = ctx.Resolve(node) as TypeResolveResult;
				if (resolveResult == null)
					return;
				var type = resolveResult.Type;
				if (type.DirectBaseTypes.Any(t => t.FullName == "System.Attribute")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomAttributes, identifier, accessibilty)) {
						return;
					}
				} else if (type.DirectBaseTypes.Any(t => t.FullName == "System.EventArgs")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomEventArgs, identifier, accessibilty)) {
						return;
					}
				} else if (type.DirectBaseTypes.Any(t => t.FullName == "System.Exception")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.CustomExceptions, identifier, accessibilty)) {
						return;
					}
				}

				var typeDef = type.GetDefinition();
				if (typeDef != null && typeDef.Attributes.Any(attr => attr.AttributeType.FullName == "NUnit.Framework.TestFixtureAttribute")) {
					if (CheckNamedResolveResult(resolveResult, node, AffectedEntity.TestType, identifier, accessibilty)) {
						return;
					}
				}

				CheckNamedResolveResult(resolveResult, node, entity, identifier, accessibilty);
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:29,代码来源:InconsistentNamingIssue.cs


示例6: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if(typeDeclaration.ClassType == ClassType.Class && typeDeclaration.Name != "Program")
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:vlad2135,项目名称:strokes,代码行数:7,代码来源:CreateClass.cs


示例7: AddSerializibility

		/// <summary>
		/// Makes sure that the PHP-visible type is serializable.
		/// </summary>
		private void AddSerializibility(TypeDeclaration type, TypeDeclaration outType)
		{
			// make the type serializable
			if (!Utility.IsDecoratedByAttribute(type, "System.SerializableAttribute"))
			{
				AttributeSection section = new AttributeSection();
				section.Attributes.Add(new ICSharpCode.NRefactory.Parser.AST.Attribute("Serializable", null, null));
				outType.Attributes.Add(section);

				ConstructorDeclaration ctor = new ConstructorDeclaration(type.Name, 
					((type.Modifier & Modifier.Sealed) == Modifier.Sealed ? Modifier.Private : Modifier.Protected),
					new List<ParameterDeclarationExpression>(), null);

				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.SerializationInfo"), "info"));
				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.StreamingContext"), "context"));

				ctor.ConstructorInitializer = new ConstructorInitializer();
				ctor.ConstructorInitializer.ConstructorInitializerType = ConstructorInitializerType.Base;
					
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("info"));
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("context"));

				ctor.Body = new BlockStatement();

				outType.AddChild(ctor);
			}
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:32,代码来源:Dynamizer.cs


示例8: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if(typeDeclaration.ClassType == ClassType.Interface)
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:clausjoergensen,项目名称:strokes,代码行数:7,代码来源:CreateInterface.cs


示例9: VisitTypeDeclaration

            public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
            {
                if (typeDeclaration.ClassType == ClassType.Class && typeDeclaration.Modifiers.HasFlag(Modifiers.Abstract))
                    UnlockWith(typeDeclaration);

                return base.VisitTypeDeclaration(typeDeclaration, data);
            }
开发者ID:vlad2135,项目名称:strokes,代码行数:7,代码来源:AbstractClass.cs


示例10: VisitTypeDeclaration

        public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
        {
            if (!typeDeclaration.HasModifier(Modifiers.Public))
            {
                base.VisitTypeDeclaration(typeDeclaration);
                return;
            }

            var idx = this.Results.BaseName.LastIndexOf('.');
            var filename = this.Results.BaseName;
            if (idx != -1)
                filename = filename.Substring(0, idx);
            if (typeDeclaration.Name != filename)
            {
                this.Results.Issues.Add(new LintIssue(typeDeclaration)
                {
                    Index = LintIssueIndex.ClassNameDoesNotMatchFileName,
                    Parameters = new[]
                    {
                        typeDeclaration.Name,
                        filename
                    }
                });
            }

            base.VisitTypeDeclaration(typeDeclaration);
        }
开发者ID:ow-pastuch,项目名称:cstools,代码行数:27,代码来源:EnsureClassNameMatchesFileNamePolicy.cs


示例11: TypeDeclaration

 public TypeDeclaration(Position pos, Symbol name, Type type, TypeDeclaration next)
 {
     Pos = pos;
     Name = name;
     Type = type;
     Next = next;
 }
开发者ID:Nxun,项目名称:Naive-Tiger,代码行数:7,代码来源:AbstractSyntax.Declaration.cs


示例12: VisitTypeDeclaration

 public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
 {
     if (typeDeclaration.TypeKeyword.ToString() == "enum")
     {
         _currentEnumMembers = new List<NameNode>();
         EnumMembers.Add(typeDeclaration, _currentEnumMembers);
     }
     base.VisitTypeDeclaration(typeDeclaration);
 }
开发者ID:KvanTTT,项目名称:CSharp-Minifier,代码行数:9,代码来源:MinifyEnumsAstVisitor.cs


示例13: CreateTypeSignature

 public static string CreateTypeSignature(TypeDeclaration type)
 {
     var @namespace = type.GetParent<NamespaceDeclaration>();
     var builder = new StringBuilder();
     builder.Append(@namespace.FullName.ToJavaNamespace());
     builder.Append("/");
     builder.Append(type.Name);
     return builder.ToString();
 }
开发者ID:hach-que,项目名称:cscjvm,代码行数:9,代码来源:JavaSignature.cs


示例14: VisitTypeDeclaration

			public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
			{
				var oldGenericStatus = isInGenericType;

				isInGenericType = typeDeclaration.TypeParameters.Count > 0;

				base.VisitTypeDeclaration(typeDeclaration);
				isInGenericType = oldGenericStatus;
			}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:9,代码来源:StaticFieldInGenericTypeIssue.cs


示例15: AddImplementation

        static void AddImplementation(RefactoringContext context, TypeDeclaration result, ICSharpCode.NRefactory.TypeSystem.IType guessedType)
        {
            foreach (var property in guessedType.GetProperties ()) {
                if (!property.IsAbstract)
                    continue;
                if (property.IsIndexer) {
                    var indexerDecl = new IndexerDeclaration() {
                        ReturnType = context.CreateShortType(property.ReturnType),
                        Modifiers = GetModifiers(property),
                        Name = property.Name
                    };
                    indexerDecl.Parameters.AddRange(ConvertParameters(context, property.Parameters));
                    if (property.CanGet)
                        indexerDecl.Getter = new Accessor();
                    if (property.CanSet)
                        indexerDecl.Setter = new Accessor();
                    result.AddChild(indexerDecl, Roles.TypeMemberRole);
                    continue;
                }
                var propDecl = new PropertyDeclaration() {
                    ReturnType = context.CreateShortType(property.ReturnType),
                    Modifiers = GetModifiers (property),
                    Name = property.Name
                };
                if (property.CanGet)
                    propDecl.Getter = new Accessor();
                if (property.CanSet)
                    propDecl.Setter = new Accessor();
                result.AddChild(propDecl, Roles.TypeMemberRole);
            }

            foreach (var method in guessedType.GetMethods ()) {
                if (!method.IsAbstract)
                    continue;
                var decl = new MethodDeclaration() {
                    ReturnType = context.CreateShortType(method.ReturnType),
                    Modifiers = GetModifiers (method),
                    Name = method.Name,
                    Body = new BlockStatement() {
                        new ThrowStatement(new ObjectCreateExpression(context.CreateShortType("System", "NotImplementedException")))
                    }
                };
                decl.Parameters.AddRange(ConvertParameters(context, method.Parameters));
                result.AddChild(decl, Roles.TypeMemberRole);
            }

            foreach (var evt in guessedType.GetEvents ()) {
                if (!evt.IsAbstract)
                    continue;
                var decl = new EventDeclaration() {
                    ReturnType = context.CreateShortType(evt.ReturnType),
                    Modifiers = GetModifiers (evt),
                    Name = evt.Name
                };
                result.AddChild(decl, Roles.TypeMemberRole);
            }
        }
开发者ID:Xiaoqing,项目名称:NRefactory,代码行数:57,代码来源:CreateClassDeclarationAction.cs


示例16: OnParseInfo

        protected override void OnParseInfo(TypeDeclaration type, ContentType definition)
        {
            base.OnParseInfo(type, definition);

            var docType = (DocumentType)definition;
            var info = (DocumentTypeInfo)docType.Info;

            info.DefaultTemplate = StringFieldValue(type, "DefaultTemplate");
            info.AllowedTemplates = StringArrayValue(type, "AllowedTemplates").ToList();
        }
开发者ID:scy0846,项目名称:Umbraco.CodeGen,代码行数:10,代码来源:DocumentTypeInfoParser.cs


示例17: VisitTypeDeclaration

 public override void VisitTypeDeclaration(TypeDeclaration typeDeclaration)
 {
     if (typeDeclaration.ClassType == ClassType.Struct && !_isCorelibCompilation) {
         _errorReporter.Message(7998, typeDeclaration.GetRegion(), "user-defined value type (struct)");
         _result = false;
     }
     else {
         base.VisitTypeDeclaration(typeDeclaration);
     }
 }
开发者ID:arnauddias,项目名称:SaltarelleCompiler,代码行数:10,代码来源:UnsupportedConstructsScanner.cs


示例18: FindContentTypeAttribute

 // TODO: Dry up
 protected static Attribute FindContentTypeAttribute(TypeDeclaration type, ContentType definition)
 {
     string attributeName;
     if (definition is MediaType)
         attributeName = "MediaType";
     else
         attributeName = "DocumentType";
     var attribute = FindAttribute(type.Attributes, attributeName);
     return attribute;
 }
开发者ID:scy0846,项目名称:Umbraco.CodeGen,代码行数:11,代码来源:StructureParser.cs


示例19: AddBaseTypesAccordingToNamingRules

 static TypeDeclaration AddBaseTypesAccordingToNamingRules(RefactoringContext context, NamingConventionService service, TypeDeclaration result)
 {
     if (service.HasValidRule(result.Name, AffectedEntity.CustomAttributes, Modifiers.Public)) {
         result.BaseTypes.Add(context.CreateShortType("System", "Attribute"));
     } else if (service.HasValidRule(result.Name, AffectedEntity.CustomEventArgs, Modifiers.Public)) {
         result.BaseTypes.Add(context.CreateShortType("System", "EventArgs"));
     } else if (service.HasValidRule(result.Name, AffectedEntity.CustomExceptions, Modifiers.Public)) {
         result.BaseTypes.Add(context.CreateShortType("System", "Exception"));
     }
     return result;
 }
开发者ID:CSRedRat,项目名称:NRefactory,代码行数:11,代码来源:CreateClassDeclarationAction.cs


示例20: OnParseInfo

 protected override void OnParseInfo(TypeDeclaration type, Definitions.ContentType definition)
 {
     var info = definition.Info;
     info.Alias = type.Name.CamelCase();
     info.Name = AttributeValue(type, "DisplayName", type.Name.SplitPascalCase());
     info.Description = AttributeValue(type, "Description", null);
     info.Master = FindMaster(type, Configuration).CamelCase();
     info.AllowAtRoot = BoolFieldValue(type, "AllowAtRoot");
     info.Icon = StringFieldValue(type, "icon", "folder.gif");
     info.Thumbnail = StringFieldValue(type, "thumbnail", "folder.png");
 }
开发者ID:jkarsrud,项目名称:Umbraco.CodeGen,代码行数:11,代码来源:CommonInfoParser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TypeDef类代码示例发布时间:2022-05-24
下一篇:
C# TypeCode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap