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

C# IFieldDefinition类代码示例

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

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



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

示例1: FieldIsNotSource

 private bool FieldIsNotSource(IFieldDefinition fieldDefinition, IExpression source)
 {
     var bound = source as BoundExpression;
     var field = bound == null? null : bound.Definition as IFieldReference;
     bool ret = bound == null || field == null || field.ResolvedField != fieldDefinition;
     return ret;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:7,代码来源:PRV_ReferenceAssignmentChange.cs


示例2: TraverseChildren

        public override void TraverseChildren(IFieldDefinition field)
        {
            if (!MemberHelper.IsVisibleOutsideAssembly(field))
                return;

            _assembly.EnrollApi(field);
        }
开发者ID:z2xlong,项目名称:ApiScanner-net,代码行数:7,代码来源:ApiTraverser.cs


示例3: Configure

        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);
            var tdefinition = definition as ITaxonFieldDefinition;
            var tManager = TaxonomyManager.GetManager();
            var tid = tdefinition.TaxonomyId;
            var taxonomy = tManager.GetTaxonomies<FlatTaxonomy>().Where(t => t.Id == tid).SingleOrDefault();
            if (taxonomy != null)
            {
                var colorsTaxa = taxonomy.Taxa.OrderBy(c => c.Title.ToString());
                this.RenderChoicesAs = Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.DropDown;

                // or you can use Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.CheckBoxes for multiple choice

                this.Choices.Clear();
                foreach (var taxon in colorsTaxa)
                {
                    var choice = new ChoiceItem();
                    choice.Value = taxon.Id.ToString();
                    choice.Text = taxon.Title;
                    choice.Enabled = true;
                    this.Choices.Add(choice);
                }
            }
        }
开发者ID:sarahmertzatpariveda,项目名称:Telerik.Sitefinity.Samples.Products,代码行数:25,代码来源:TaxonomyDropDownField.cs


示例4: GetHiddenField

 /// <summary>
 /// Returns the field from the closest base class that is hidden by the given field according to C# rules.
 /// </summary>
 public static IFieldDefinition GetHiddenField(IFieldDefinition derivedClassField) {
   var typeDef = derivedClassField.ContainingTypeDefinition;
   foreach (ITypeReference baseClassReference in typeDef.BaseClasses) {
     IFieldDefinition hiddenField = GetHiddenField(derivedClassField, baseClassReference.ResolvedType);
     if (!(hiddenField is Dummy)) return hiddenField;
   }
   return Dummy.FieldDefinition;
 }
开发者ID:xornand,项目名称:cci,代码行数:11,代码来源:Utils.cs


示例5: WriteFieldDefinition

        private void WriteFieldDefinition(IFieldDefinition field)
        {
            if (field.IsSpecialName)
                return;

            // Do we care about volatile?
            WriteAttributes(field.Attributes);
            if (!field.IsStatic && field.ContainingTypeDefinition.Layout == LayoutKind.Explicit)
            {
                WriteFakeAttribute("System.Runtime.InteropServices.FieldOffsetAttribute", field.Offset.ToString());
            }

            if (!field.ContainingTypeDefinition.IsEnum)
            {
                WriteVisibility(field.Visibility);

                if (field.Type.IsUnsafeType())
                    WriteKeyword("unsafe");

                if (field.IsCompileTimeConstant)
                    WriteKeyword("const");
                else
                {
                    if (field.IsStatic)
                        WriteKeyword("static");
                    if (field.IsReadOnly)
                        WriteKeyword("readonly");
                }

                if (!field.IsCompileTimeConstant && field.GetHiddenBaseField(_filter) != Dummy.Field)
                    WriteKeyword("new");

                WriteTypeName(field.Type);
                WriteIdentifier(field.Name);

                if (field.Constant != null && field.IsCompileTimeConstant)
                {
                    WriteSpace();
                    WriteSymbol("=", true);
                    WriteMetadataConstant(field.Constant);
                }

                WriteSymbol(";");
            }
            else
            {
                WriteIdentifier(field.Name);
                if (field.Constant != null && field.Constant.Value != null)
                {
                    WriteSpace();
                    WriteSymbol("=", true);
                    WriteMetadataConstant(field.Constant);
                }
                WriteSymbol(",");
            }
        }
开发者ID:lishibo,项目名称:buildtools,代码行数:56,代码来源:CSDeclarationWriter.Fields.cs


示例6: Visit

        public override void Visit(IFieldDefinition fieldDefinition)
        {
            NewLine();
            Indent(2);

            AppendElementType(fieldDefinition);
            base.Visit(fieldDefinition);

            output.Append(fieldDefinition.Name.Value);
            AppendSpace();
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:11,代码来源:CodePrinter.cs


示例7: TryGetField

 internal override bool TryGetField(IFieldDefinition def, out uint index)
 {
     TypeFromMetadata type;
     if (this.TryGetTypeDefinition(def.ContainingTypeDefinition, out type))
     {
         FieldHandle handle;
         if (type.TryGetField(def.Name, out handle))
         {
             index = (uint)handle.GetRowNumber();
             return true;
         }
     }
     index = 0;
     return false;
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:15,代码来源:InitialPeGeneration.cs


示例8: GetReferenceOfFieldUsedByPeers

    /// <summary>
    /// Given a field definition in the closure class, get its reference as will be used by the methods in the closure class. 
    /// </summary>
    internal IFieldReference GetReferenceOfFieldUsedByPeers(IFieldDefinition fieldDef) {

      IFieldReference fieldReference = null;
      ITypeReference typeReference = this.ClosureDefinitionReference;
      ISpecializedNestedTypeReference nestedTypeRef = typeReference as ISpecializedNestedTypeReference;
      IGenericTypeInstanceReference genericTypeInstanceRef = typeReference as IGenericTypeInstanceReference;
      if (nestedTypeRef != null || genericTypeInstanceRef != null) {
        fieldReference = new SpecializedFieldReference() {
          ContainingType = typeReference,
          InternFactory = this.host.InternFactory,
          Name = fieldDef.Name,
          UnspecializedVersion = fieldDef,
          Type = fieldDef.Type
        };
      } else fieldReference = fieldDef;
      return fieldReference;
    }
开发者ID:xornand,项目名称:cci,代码行数:20,代码来源:Helpers.cs


示例9: TraverseChildren

    public override void TraverseChildren(IFieldDefinition fieldDefinition) {
      if (fieldDefinition.ContainingType.IsEnum && fieldDefinition.IsRuntimeSpecial && fieldDefinition.IsSpecialName)
        return; // implicit value field of an enum

      if (!this.printCompilerGeneratedMembers &&
        AttributeHelper.Contains(fieldDefinition.Attributes, fieldDefinition.Type.PlatformType.SystemRuntimeCompilerServicesCompilerGeneratedAttribute))
        return; // eg. a cached anonymous delegate - may have invalid symbols

      foreach (var e in fieldDefinition.ContainingTypeDefinition.Events) {
        if (e.Name == fieldDefinition.Name)
          return;   // field is probably the implicit delegate backing the event
      }

      // Figure out if this is a special fixed buffer field
      ICustomAttribute fixedBufferAttr = Utils.FindAttribute(fieldDefinition.Attributes, SpecialAttribute.FixedBuffer);

      if (fixedBufferAttr == null)
        PrintAttributes(fieldDefinition);

      if (fieldDefinition.ContainingTypeDefinition.Layout == LayoutKind.Explicit)
        PrintPseudoCustomAttribute(fieldDefinition, "System.Runtime.InteropServices.FieldOffset", fieldDefinition.Offset.ToString(), true, null);

      PrintToken(CSharpToken.Indent);

      if (fieldDefinition.IsCompileTimeConstant && fieldDefinition.ContainingType.IsEnum) {
        PrintFieldDefinitionEnumValue(fieldDefinition);
      } else {
        PrintFieldDefinitionVisibility(fieldDefinition);
        PrintFieldDefinitionModifiers(fieldDefinition);

        if (fixedBufferAttr == null) {
          PrintFieldDefinitionType(fieldDefinition);
          PrintToken(CSharpToken.Space);
          PrintFieldDefinitionName(fieldDefinition);
          if (fieldDefinition.IsCompileTimeConstant) {
            sourceEmitterOutput.Write(" = ");
            PrintFieldDefinitionValue(fieldDefinition);
          }
        } else {
          PrintFieldDefinitionFixedBuffer(fieldDefinition, fixedBufferAttr);
        }
        PrintToken(CSharpToken.Semicolon);
      }
    }
开发者ID:xornand,项目名称:cci,代码行数:44,代码来源:FieldSourceEmitter.cs


示例10: PrintFieldDefinitionValue

    public virtual void PrintFieldDefinitionValue(IFieldDefinition fieldDefinition) {
      Contract.Requires(fieldDefinition != null);

      // We've got context here about the field that can be used to provide a better value.
      // For enums, the IMetadataConstant is just the primitive value
      var fieldType = fieldDefinition.Type.ResolvedType;
      if (fieldType.IsEnum) {
        PrintEnumValue(fieldType, fieldDefinition.CompileTimeValue.Value);
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType.PlatformType.SystemFloat32) && 
                 fieldType.TypeCode == PrimitiveTypeCode.Float32) {
        // Defining System.Single, can't reference the symbolic names, use constant hacks instead
        float val = (float)fieldDefinition.CompileTimeValue.Value;
        if (float.IsNegativeInfinity(val))
          sourceEmitterOutput.Write("-1.0f / 0.0f");
        else if (float.IsPositiveInfinity(val))
          sourceEmitterOutput.Write("1.0f / 0.0f");
        else if (float.IsNaN(val))
          sourceEmitterOutput.Write("0.0f / 0.0f");
        else
          sourceEmitterOutput.Write(val.ToString("R") + "f");
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType.PlatformType.SystemFloat64) &&
                 fieldType.TypeCode == PrimitiveTypeCode.Float64) {
        // Defining System.Double, can't reference the symbolic names, use constant hacks instead
        double val = (double)fieldDefinition.CompileTimeValue.Value;
        if (double.IsNegativeInfinity(val))
          sourceEmitterOutput.Write("-1.0 / 0.0");
        else if (double.IsPositiveInfinity(val))
          sourceEmitterOutput.Write("1.0 / 0.0");
        else if (double.IsNaN(val))
          sourceEmitterOutput.Write("0.0 / 0.0");
        else
          sourceEmitterOutput.Write(val.ToString("R"));
      } else if (TypeHelper.TypesAreEquivalent(fieldDefinition.ContainingTypeDefinition, fieldType) && 
        (fieldType.TypeCode == PrimitiveTypeCode.Int32 || fieldType.TypeCode == PrimitiveTypeCode.UInt32 ||
         fieldType.TypeCode == PrimitiveTypeCode.Int64 || fieldType.TypeCode == PrimitiveTypeCode.UInt64)) {
        // Defining a core integral system type, can't reference the symbolic names, use constants
        sourceEmitterOutput.Write(fieldDefinition.CompileTimeValue.Value.ToString());
      } else {
        this.Traverse(fieldDefinition.CompileTimeValue);
      }
    }
开发者ID:xornand,项目名称:cci,代码行数:41,代码来源:FieldSourceEmitter.cs


示例11: Configure

        public override void Configure(IFieldDefinition definition)
        {
            base.Configure(definition);
            var aManager = AgentsManager.GetManager();
            var agents = aManager.GetAgents().OrderBy(a => a.Title).Where(a => a.Status == Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live);
            if (agents != null)
            {
                this.RenderChoicesAs = Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.DropDown; //
                // or you can use Telerik.Sitefinity.Web.UI.Fields.Enums.RenderChoicesAs.CheckBoxes for multiple choice

                this.Choices.Clear();
                foreach (var agent in agents)
                {
                    var choice = new ChoiceItem();
                    choice.Value = agent.Id.ToString();
                    choice.Text = agent.Title;
                    choice.Enabled = true;
                    this.Choices.Add(choice);
                }
            }
        }
开发者ID:jrcollado1987,项目名称:Telerik.Sitefinity.Samples.RealEstate,代码行数:21,代码来源:AgentsDropDown.cs


示例12: CheckPortableAttributes

 private void CheckPortableAttributes(IFieldDefinition fd, IPortable portable)
 {
     if (fd.GetFactoryId() != portable.GetFactoryId())
     {
         throw new HazelcastSerializationException(
             "Wrong Portable type! Generic portable types are not supported! " + " Expected factory-id: " +
             fd.GetFactoryId() + ", Actual factory-id: " + portable.GetFactoryId());
     }
     if (fd.GetClassId() != portable.GetClassId())
     {
         throw new HazelcastSerializationException(
             "Wrong Portable type! Generic portable types are not supported! " + "Expected class-id: " +
             fd.GetClassId() + ", Actual class-id: " + portable.GetClassId());
     }
 }
开发者ID:hasancelik,项目名称:hazelcast-csharp-client,代码行数:15,代码来源:DefaultPortableWriter.cs


示例13: Visit

 public override void Visit(IFieldDefinition field)
 {
     if (IsMemberExternallyVisible2(field))
     {
         // Recursion
         Visit(field.Type);
     }
 }
开发者ID:natemcmaster,项目名称:buildtools,代码行数:8,代码来源:ApiClosureVisitor.cs


示例14: Visit

 public void Visit(IFieldDefinition fieldDefinition)
 {
     this.traverser.Traverse(fieldDefinition);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:4,代码来源:Visitors.cs


示例15: Visit

 public void Visit(IFieldDefinition fieldDefinition)
 {
     throw new NotImplementedException();
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:4,代码来源:Visitors.cs


示例16: Field

 public Field(FieldInfo fieldInfo, IFieldDefinition fieldDefinition)
 {
     this.fieldInfo = fieldInfo;
     this.fieldDefinition = fieldDefinition;
 }
开发者ID:RobSmyth,项目名称:nserializer,代码行数:5,代码来源:Field.cs


示例17: TraverseChildren

        public override void TraverseChildren(IFieldDefinition fieldDefinition)
{ MethodEnter(fieldDefinition);
            base.TraverseChildren(fieldDefinition);
     MethodExit();   }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:4,代码来源:DebugCodeTraverser.cs


示例18: Traverse

 /// <summary>
 /// Traverses the field definition.
 /// </summary>
 public void Traverse(IFieldDefinition fieldDefinition)
 {
     Contract.Requires(fieldDefinition != null);
       //specialized fields are simply traversed as if they were normal fields
       if (this.preorderVisitor != null) fieldDefinition.Dispatch(this.preorderVisitor);
       if (this.stopTraversal) return;
       this.TraverseChildren(fieldDefinition);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) fieldDefinition.Dispatch(this.postorderVisitor);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:13,代码来源:Visitors.cs


示例19: EmitGenericTypeObject

    private void EmitGenericTypeObject(uint index, IFieldDefinition field, bool isStatic) {
      Contract.Requires(field != null);

      this.sourceEmitter.EmitString("(uintptr_t)((void**)((");
      if (isStatic) {
        this.EmitTypeReference(this.host.PlatformType.SystemType);
        this.sourceEmitter.EmitString(")(typeObject");
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
      } else {
        this.EmitTypeReference(this.host.PlatformType.SystemType);
        this.sourceEmitter.EmitString(")(((");
        this.EmitTypeReference(this.host.PlatformType.SystemObject);
        this.sourceEmitter.EmitString(")");
        this.sourceEmitter.EmitString("(");
        this.sourceEmitter.EmitString("_this ");
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
        this.sourceEmitter.EmitString(")->");
        this.sourceEmitter.EmitString(this.GetMangledFieldName(this.typeField));
        this.EmitAdjustPointerToHeaderFromData();
        this.sourceEmitter.EmitString(")");
      }
      this.sourceEmitter.EmitString(")->");
      this.sourceEmitter.EmitString(this.GetMangledFieldName(field));
      this.sourceEmitter.EmitString(")[" + index + "]");
    }
开发者ID:mestriga,项目名称:Microsoft.CciSamples,代码行数:27,代码来源:Instructions.cs


示例20: TraverseChildren

 /// <summary>
 /// Traverses the children of the field definition.
 /// </summary>
 public virtual void TraverseChildren(IFieldDefinition fieldDefinition)
 {
     Contract.Requires(fieldDefinition != null);
       this.TraverseChildren((ITypeDefinitionMember)fieldDefinition);
       if (this.stopTraversal) return;
       if (fieldDefinition.IsCompileTimeConstant) {
     this.Traverse(fieldDefinition.CompileTimeValue);
     if (this.stopTraversal) return;
       }
       if (fieldDefinition.IsModified) {
     this.Traverse(fieldDefinition.CustomModifiers);
     if (this.stopTraversal) return;
       }
       if (fieldDefinition.IsMarshalledExplicitly) {
     this.Traverse(fieldDefinition.MarshallingInformation);
     if (this.stopTraversal) return;
       }
       this.Traverse(fieldDefinition.Type);
 }
开发者ID:rasiths,项目名称:visual-profiler,代码行数:22,代码来源:Visitors.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IFieldReference类代码示例发布时间:2022-05-24
下一篇:
C# IField类代码示例发布时间: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