本文整理汇总了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;
}
示例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));
}
示例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;
}