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


C# MemberInfo类代码示例

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


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

示例1: FromMemberInfo

 public static VNodeInfo FromMemberInfo(MemberInfo member)
 {
     return new VNodeInfo(member.InstanceId, 0,
                          member.InternalTcpEndPoint, member.InternalSecureTcpEndPoint,
                          member.ExternalTcpEndPoint, member.ExternalSecureTcpEndPoint,
                          member.InternalHttpEndPoint, member.ExternalHttpEndPoint);
 }
开发者ID:danieldeb,项目名称:EventStore,代码行数:7,代码来源:VNodeInfo.cs

示例2: ShowAttributes

    private static void ShowAttributes(MemberInfo attributeTarget)
    {
        Attribute[] attributes = Attribute.GetCustomAttributes(attributeTarget);

        Console.WriteLine("Attributes applied to {0}: {1}",
           attributeTarget.Name, (attributes.Length == 0 ? "None" : String.Empty));

        foreach (Attribute attribute in attributes)
        {
            // Display the type of each applied attribute
            Console.WriteLine("  {0}", attribute.GetType().ToString());

            if (attribute is DefaultMemberAttribute)
                Console.WriteLine("    MemberName={0}",
                   ((DefaultMemberAttribute)attribute).MemberName);

            if (attribute is ConditionalAttribute)
                Console.WriteLine("    ConditionString={0}",
                   ((ConditionalAttribute)attribute).ConditionString);

            if (attribute is CLSCompliantAttribute)
                Console.WriteLine("    IsCompliant={0}",
                   ((CLSCompliantAttribute)attribute).IsCompliant);

            DebuggerDisplayAttribute dda = attribute as DebuggerDisplayAttribute;
            if (dda != null)
            {
                Console.WriteLine("    Value={0}, Name={1}, Target={2}",
                   dda.Value, dda.Name, dda.Target);
            }
        }
        Console.WriteLine();
    }
开发者ID:isel-leic-ave,项目名称:ave-2015-16-sem1-i41n,代码行数:33,代码来源:Program.cs

示例3: GetCustomAttributes

        public static IList<CustomAttributeData> GetCustomAttributes(MemberInfo target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            IList<CustomAttributeData> cad = GetCustomAttributes(target.Module, target.MetadataToken);

            int pcaCount = 0;
            Attribute[] a = null;
            if (target is RuntimeType)
                a = PseudoCustomAttribute.GetCustomAttributes((RuntimeType)target, typeof(object), false, out pcaCount);
            else if (target is RuntimeMethodInfo)
                a = PseudoCustomAttribute.GetCustomAttributes((RuntimeMethodInfo)target, typeof(object), false, out pcaCount);
            else if (target is RuntimeFieldInfo)
                a = PseudoCustomAttribute.GetCustomAttributes((RuntimeFieldInfo)target, typeof(object), out pcaCount);

            if (pcaCount == 0)
                return cad;

            CustomAttributeData[] pca = new CustomAttributeData[cad.Count + pcaCount];
            cad.CopyTo(pca, pcaCount);
            for (int i = 0; i < pcaCount; i++)
            {
                if (PseudoCustomAttribute.IsSecurityAttribute(a[i].GetType()))
                    continue;

                pca[i] = new CustomAttributeData(a[i]);
            }

            return Array.AsReadOnly(pca);
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:31,代码来源:customattribute.cs

示例4: ShouldShowField

    /// <summary>
    ///     Additional checks for slot & item type
    /// </summary>
    /// <param name="memberData">Member info</param>
    /// <returns>True if the field should be shown</returns>
    protected override bool ShouldShowField(MemberInfo memberData)
    {
        if (!base.ShouldShowField(memberData))
            return false;

        var limitSlotsAttr = memberData.GetAttribute<ItemDatablockEquipmentSlotAttribute>();
        if (limitSlotsAttr != null)
        {
            FieldInfo slotField = itemDatablock.GetType().GetField("equipmentSlot");
            var datablockSlot = itemDatablock.GetFieldValue<ItemDatablock.Slot>(slotField);
            foreach (ItemDatablock.Slot slot in limitSlotsAttr.slots)
            {
                if (datablockSlot == slot)
                    return true;
            }

            return false;
        }

        var limitTypeAttr = memberData.GetAttribute<ItemDatablockItemTypeAttribute>();
        if (limitTypeAttr != null)
        {
            FieldInfo itemTypeField = itemDatablock.GetType().GetField("itemType");
            var datablockType = itemDatablock.GetFieldValue<ItemDatablock.ItemType>(itemTypeField);
            foreach (ItemDatablock.ItemType type in limitTypeAttr.types)
            {
                if (datablockType == type)
                    return true;
            }

            return false;
        }

        return true;
    }
开发者ID:Daloupe,项目名称:Syzygy_Git,代码行数:40,代码来源:ItemDatablockEditor.cs

示例5: MemberToString

    public static string MemberToString(MemberInfo member, object instance)
    {
        StringBuilder o = new StringBuilder();

        XPathAttribute[] attrs = (XPathAttribute[]) member.GetCustomAttributes(typeof(XPathAttribute), true);
        if (attrs.Length == 0)
            return String.Empty;

        o.AppendFormat("{0}: ", member.Name);

        Type member_type;
        if (member is PropertyInfo)
            member_type = ((PropertyInfo)member).PropertyType;
        else
            member_type = ((FieldInfo)member).FieldType;

        if (member_type.IsArray) {
            object[] items = (object[])GetMemberValue(member, instance);
            if (items != null) {
                StringBuilder arr = new StringBuilder();
                foreach (object item in items)
                    arr.AppendFormat("{0}{1}", (arr.Length == 0) ? "" : ", ",
                                     DebugExtractInfo.ToString(item));

                o.AppendFormat("[{0}]", arr);
            }
            else
                o.Append("[]");
        }
        else
            o.Append(DebugExtractInfo.ToString(GetMemberValue(member, instance)));

        return o.ToString();
    }
开发者ID:nerochiaro,项目名称:webcontent-cs,代码行数:34,代码来源:Debug.cs

示例6: GetNarrative

    private string GetNarrative()
    {
        MemberInfo mi = new MemberInfo(CurrentUserID);
        DataSet dsNarrative = mi.GetNarrative(MemberMasterID, AssessmentID);
        DataTable dtMemberInfo = new DataTable();
        DataTable dtNarration = new DataTable();
        string Narration = string.Empty;
        if (dsNarrative.Tables.Count > 0)
        {
            dtMemberInfo = dsNarrative.Tables[0];
            dtNarration = dsNarrative.Tables[1];
        }

        if (dtNarration.Rows.Count > 0)
        {
            Narration = dtNarration.Rows[0]["NARRATION"].ToString();
        }
        if (dtMemberInfo.Rows.Count > 0)
        {
            for (int i = 0; i < dtMemberInfo.Columns.Count; i++)
            {
                Narration = Narration.Replace(dtMemberInfo.Columns[i].ColumnName, dtMemberInfo.Rows[0][i].ToString());
            }
        }
        return Narration;
    }
开发者ID:skgw,项目名称:GWHRA,代码行数:26,代码来源:Narrative.aspx.cs

示例7: GetObjectData

	public static Object[] GetObjectData(Object obj, MemberInfo[] members)
			{
				if(obj == null)
				{
					throw new ArgumentNullException("obj");
				}
				if(members == null)
				{
					throw new ArgumentNullException("members");
				}
				Object[] data = new Object [members.Length];
				int index;
				for(index = 0; index < members.Length; ++index)
				{
					if(members[index] == null)
					{
						throw new ArgumentNullException
							("members[" + index.ToString() + "]");
					}
					if(!(members[index] is FieldInfo))
					{
						throw new SerializationException
							(_("Serialize_NotField"));
					}
					data[index] = ((FieldInfo)(members[index])).GetValue(obj);
				}
				return data;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:28,代码来源:FormatterServices.cs

示例8: AnalyzeMember

        private Issue AnalyzeMember(MemberInfo memberInfo, SemanticModel model, ClassInfo classInfo)
        {
            foreach (BlockSyntax block in memberInfo.Blocks)
            {
                var identifiers = block.DescendantNodes().OfType<IdentifierNameSyntax>().ToList();

                foreach (IdentifierNameSyntax identifierName in identifiers)
                {
                    SymbolInfo identifierSymbol = model.GetSymbolInfo(identifierName);

                    //Does this symbol refer to a GuardedField?
                    GuardedFieldInfo foundGuardedField = classInfo.GuardedFields.FirstOrDefault(field => field.Symbol == identifierSymbol.Symbol);

                    if (foundGuardedField != null)
                    {
                        //We must be inside a lock statement
                        LockHierarchy controlFlowHierarchy = CreateLockHiearchyFromIdentifier(identifierName);

                        bool lockHierarchySatisfied = LockHierarchy.IsSatisfiedBy(foundGuardedField.DeclaredLockHierarchy, controlFlowHierarchy);

                        if (!lockHierarchySatisfied)
                        {
                            return new Issue(
                                ErrorCode.GUARDED_FIELD_ACCESSED_OUTSIDE_OF_LOCK,
                                identifierName,
                                identifierSymbol.Symbol);
                        }
                    }
                }
            }

            return null;
        }
开发者ID:flashcurd,项目名称:ThreadSafetyAnnotations,代码行数:33,代码来源:GuardedFieldAccessedOutsideOfLock.cs

示例9: MemberInfoDto

        public MemberInfoDto(MemberInfo member)
        {
            InstanceId = member.InstanceId;

            TimeStamp = member.TimeStamp;
            State = member.State;
            IsAlive = member.IsAlive;

            InternalTcpIp = member.InternalTcpEndPoint.Address.ToString();
            InternalTcpPort = member.InternalTcpEndPoint.Port;
            InternalSecureTcpPort = member.InternalSecureTcpEndPoint == null ? 0 : member.InternalSecureTcpEndPoint.Port;
            
            ExternalTcpIp = member.ExternalTcpEndPoint.Address.ToString();
            ExternalTcpPort = member.ExternalTcpEndPoint.Port;
            ExternalSecureTcpPort = member.ExternalSecureTcpEndPoint == null ? 0 : member.ExternalSecureTcpEndPoint.Port;

            InternalHttpIp = member.InternalHttpEndPoint.Address.ToString();
            InternalHttpPort = member.InternalHttpEndPoint.Port;

            ExternalHttpIp = member.ExternalHttpEndPoint.Address.ToString();
            ExternalHttpPort = member.ExternalHttpEndPoint.Port;

            LastCommitPosition = member.LastCommitPosition;
            WriterCheckpoint = member.WriterCheckpoint;
            ChaserCheckpoint = member.ChaserCheckpoint;
            
            EpochPosition = member.EpochPosition;
            EpochNumber = member.EpochNumber;
            EpochId = member.EpochId;

            NodePriority = member.NodePriority;
        }
开发者ID:Kristinn-Stefansson,项目名称:EventStore,代码行数:32,代码来源:MemberInfoDto.cs

示例10: GetColumnDbType

 public override string GetColumnDbType(MappingEntity entity, MemberInfo member)
 {
     AttributeMappingMember mm = ((AttributeMappingEntity)entity).GetMappingMember(member.Name);
     if (mm != null && mm.Column != null && !string.IsNullOrEmpty(mm.Column.DbType))
         return mm.Column.DbType;
     return null;
 }
开发者ID:firestrand,项目名称:IQToolkit,代码行数:7,代码来源:AttributeMapping.cs

示例11: CreateControl

 public override Lilium.Controls.Control CreateControl(MemberInfo memberInfo, object obj)
 {
     var fieldInfo = memberInfo as FieldInfo;
     Func<string> func;
     if(fieldInfo.FieldType == typeof(SharpDX.Vector3))
     {
         func = () =>
             {
                 var vec = (SharpDX.Vector3)fieldInfo.GetValue(obj);
                 return vec.ToString("0.###");
             };
     }
     else if(fieldInfo.FieldType == typeof(SharpDX.Vector4))
     {
         func = () =>
             {
                 var vec = (SharpDX.Vector4)fieldInfo.GetValue(obj);
                 return vec.ToString("0.###");
             };
     }
     else
     {
         func = ()=> fieldInfo.GetValue(obj).ToString();
     }
     return new Lilium.Controls.Label(memberInfo.Name, func);
 }
开发者ID:woncomp,项目名称:LiliumLab,代码行数:26,代码来源:Label.cs

示例12: RunField

    void RunField(MemberInfo member, Assembly assembly)
    {
      var fieldInfo = (FieldInfo)member;
      var context = _explorer.FindContexts(fieldInfo);

      StartRun(CreateMap(assembly, new[] {context}));
    }
开发者ID:hennys,项目名称:machine.specifications,代码行数:7,代码来源:DefaultRunner.cs

示例13: GetFamilyMembers

 public static List<FamilyMember> GetFamilyMembers(int MemberMasterID)
 {
     MemberInfo mInfo;
     mInfo = new MemberInfo(MemberMasterID, 1);
     List<FamilyMember> siblings = mInfo.familyMembers;
     return siblings;
 }
开发者ID:skgw,项目名称:GWHRA,代码行数:7,代码来源:FamilyHRA.aspx.cs

示例14: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     MemberMasterID = Int32.Parse(Request.QueryString["ID"]);
     AssessmentID = Int32.Parse(Request.QueryString["AssessmentID"]);
     mInfo = new MemberInfo(MemberMasterID, CurrentUserID);
     Master.PageHeader = "Member HRA";
 }
开发者ID:skgw,项目名称:GWHRA,代码行数:7,代码来源:MemberHRA.aspx.cs

示例15: Create

 public static AttributeMap[] Create(TypeModel model, MemberInfo member, bool inherit)
 {
     #if FEAT_IKVM
     System.Collections.Generic.IList<CustomAttributeData> all = member.__GetCustomAttributes(model.MapType(typeof(Attribute)), inherit);
     AttributeMap[] result = new AttributeMap[all.Count];
     int index = 0;
     foreach (CustomAttributeData attrib in all)
     {
         result[index++] = new AttributeDataMap(attrib);
     }
     return result;
     #else
     #if WINRT
     Attribute[] all = System.Linq.Enumerable.ToArray(member.GetCustomAttributes(inherit));
     #else
     var all = member.GetCustomAttributes(inherit);
     #endif
     var result = new AttributeMap[all.Length];
     for (var i = 0; i < all.Length; i++)
     {
         result[i] = new ReflectionAttributeMap((Attribute) all[i]);
     }
     return result;
     #endif
 }
开发者ID:289997171,项目名称:vicking,代码行数:25,代码来源:AttributeMap.cs


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