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


C# CodeTypeMember.GetType方法代码示例

本文整理汇总了C#中System.CodeDom.CodeTypeMember.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CodeTypeMember.GetType方法的具体用法?C# CodeTypeMember.GetType怎么用?C# CodeTypeMember.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.CodeDom.CodeTypeMember的用法示例。


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

示例1: ValidateTypeMember

        private void ValidateTypeMember(CodeTypeMember e) {
            ValidateCommentStatements(e.Comments);
            ValidateCodeDirectives(e.StartDirectives);
            ValidateCodeDirectives(e.EndDirectives);
            if (e.LinePragma != null) ValidateLinePragmaStart(e.LinePragma);

            if (e is CodeMemberEvent) {
                ValidateEvent((CodeMemberEvent)e);
            } 
            else if (e is CodeMemberField) {
                ValidateField((CodeMemberField)e);
            } 
            else if (e is CodeMemberMethod) {
                ValidateMemberMethod((CodeMemberMethod)e);
            } 
            else if (e is CodeMemberProperty) {
                ValidateProperty((CodeMemberProperty)e);
            } 
            else if (e is CodeSnippetTypeMember) {
                ValidateSnippetMember((CodeSnippetTypeMember)e);
            } 
            else if (e is CodeTypeDeclaration) {
                ValidateTypeDeclaration((CodeTypeDeclaration)e);
            } 
            else {
                throw new ArgumentException(SR.GetString(SR.InvalidElementType, e.GetType().FullName), "e");
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:CodeValidator.cs

示例2: CodeTypeMemberExtension

 /// <summary>
 /// Creates a new instance of CodeTypeMemberExtension class.
 /// </summary>
 /// <param name="extendObject">An object to be decorated by this instance.</param>
 public CodeTypeMemberExtension(CodeTypeMember extendedObject, CodeTypeExtension parent) 
     : base(extendedObject)
 {                                  
     if (typeof(CodeMemberField) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Field;
     }
     else if (typeof(CodeMemberMethod) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Method;
     }
     else if (typeof(CodeMemberProperty) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Property;
     }
     else if (typeof(CodeMemberEvent) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Event;
     }
     else if (typeof(CodeSnippetTypeMember) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Snippet;
     }
     else if (typeof(CodeConstructor) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.Constructor;
     }
     else if (typeof(CodeTypeConstructor) == extendedObject.GetType())
     {
         this.kind = CodeTypeMemberKind.StaticConstructor;
     }
     this.parent = parent;
 }
开发者ID:gtri-iead,项目名称:LEXS-NET-Sample-Implementation-3.1.4,代码行数:37,代码来源:CodeTypeMemberExtension.cs

示例3: Translate

 private void Translate(CodeTypeMember member, TypeNode declaringType){
   if (member == null) return;
   else if (member is CodeMemberEvent) this.Translate((CodeMemberEvent)member, declaringType);
   else if (member is CodeMemberField) this.Translate((CodeMemberField)member, declaringType);
   else if (member is CodeMemberMethod) this.Translate((CodeMemberMethod)member, declaringType);
   else if (member is CodeMemberProperty) this.Translate((CodeMemberProperty)member, declaringType);
   else if (member is CodeSnippetTypeMember) this.Translate((CodeSnippetTypeMember)member, declaringType);
   else if (member is CodeTypeDeclaration) this.Translate((CodeTypeDeclaration)member, null, declaringType);
   else throw new ArgumentException("unknown type member", member.GetType().FullName);
 }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:10,代码来源:CodeDom.cs


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