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


C# ITypeDefinition.GetFields方法代码示例

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


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

示例1: GetExportedDeclaredAndGeneratedFields

        protected IEnumerable<IMember> GetExportedDeclaredAndGeneratedFields(ITypeDefinition ce, bool isStatic)
        {
            foreach (var pe in ce.GetFields(t => t.IsStatic == isStatic, GetMemberOptions.IgnoreInheritedMembers))
            {
                if (!Sk.IsJsExported(pe))
                    continue;
                yield return pe;
            }

            foreach (var pe in ce.GetEvents(t => t.IsStatic == isStatic, GetMemberOptions.IgnoreInheritedMembers))
            {
                if (!Sk.IsJsExported(pe))
                    continue;
                yield return pe;
            }

            foreach (var fe in GeneratePropertyFields(ce, isStatic))
                yield return fe;
        }
开发者ID:benbon,项目名称:SharpKit,代码行数:19,代码来源:MemberConverter.cs

示例2: Visit

        public override void Visit(ITypeDefinition typeDefinition)
        {
            VisitTypeDefinitionNoMembers(typeDefinition);

            this.Visit(typeDefinition.Events);
            this.Visit(typeDefinition.GetFields(Context));
            this.Visit(typeDefinition.GetMethods(Context));
            this.VisitNestedTypes(typeDefinition.GetNestedTypes(Context));
            this.Visit(typeDefinition.GetProperties(Context));
        }
开发者ID:elemk0vv,项目名称:roslyn-1,代码行数:10,代码来源:ReferenceIndexer.cs

示例3: ExportClassStructInterface

        private JsNode ExportClassStructInterface(ITypeDefinition ce)
        {
            var jsType = new JsClrType();
            jsType.Kind = GetJsTypeKind(ce);
            jsType.fullname = GetJsTypeName(ce);
            var baseClass = GetBaseClassIfValid(ce, true);
            if (baseClass != null)
            {
                var baseClassName = GetJsTypeName(baseClass);
                if (baseClassName != jsType.fullname)   //avoid object:object inheritance recursion
                    jsType.baseTypeName = baseClassName;
            }
            var globalCode = new List<JsUnit>();
            if (!ce.IsInterface() || Sk.NewInterfaceImplementation)
            {
                var members = GetMembersToExport(ce);
                var inlineFields = Sk.InlineFields(ce);
                var cctor = ce.GetConstructors(false, true).FirstOrDefault();
                if (cctor == null && !inlineFields && ce.GetFields().Where(t => t.IsStatic).FirstOrDefault() != null)
                {

                    cctor = CreateStaticCtor(ce);
                    if (ShouldExportConstructor(cctor))
                        members.Insert(0, cctor);
                }

                var mappings = members.Select(t => new EntityToJsNode { JsNode = Visit(t), Entity = t }).ToList();

                //Remove GlobalCode=True members from mappings
                for (var i = mappings.Count - 1; i >= 0; i--)
                {
                    if (mappings[i].JsNode is JsUnit)
                    { //Maybe more clean: Another way could be to check the IEntity for GlobalCode=True
                        globalCode.Add((JsUnit)mappings[i].JsNode);
                        mappings.RemoveAt(i);
                    }
                }

                ImportToType(jsType, mappings);
            }
            ExportImplementedInterfaces(ce, jsType);
            jsType.assemblyName = AssemblyName;
            var atts = ExportCustomAttributes(ce);
            if (atts.IsNotNullOrEmpty())
            {
                if (jsType.customAttributes == null)
                    jsType.customAttributes = new JsArray<JsClrAttribute>();
                jsType.customAttributes.AddRange(atts);
            }
            var unit = OnAfterExportType(ce, jsType);
            globalCode.ForEach(t => unit.Statements.AddRange(t.Statements));
            return unit;
        }
开发者ID:benbon,项目名称:SharpKit,代码行数:53,代码来源:MemberConverter_Clr.cs


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