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


C# MemberInfo.GetEditorHint方法代码示例

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


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

示例1: EditorMemberAffectsOthers

 private bool EditorMemberAffectsOthers(MemberInfo info)
 {
     EditorHintFlagsAttribute flagsAttrib = info.GetEditorHint<EditorHintFlagsAttribute>();
     return this.ShowNonPublic || (flagsAttrib != null && (flagsAttrib.Flags & MemberFlags.AffectsOthers) != MemberFlags.None);
 }
开发者ID:ruzli,项目名称:duality,代码行数:5,代码来源:DualitorPropertyGrid.cs

示例2: EditorMemberPredicate

        private bool EditorMemberPredicate(MemberInfo info, bool showNonPublic)
        {
            PropertyInfo property = info as PropertyInfo;
            FieldInfo field = info as FieldInfo;
            EditorHintFlagsAttribute flagsAttrib = info.GetEditorHint<EditorHintFlagsAttribute>();

            // Accept all members in "Debug Mode", if not declared inside Duality itself
            if (showNonPublic && info.DeclaringType.Assembly != typeof(DualityApp).Assembly) return true;

            // Accept explicitly visible members
            if (flagsAttrib != null && (flagsAttrib.Flags & MemberFlags.Visible) != MemberFlags.None) return true;

            // Reject properties with non-public getters
            if (property != null)
            {
                MethodInfo getter = property.GetGetMethod(true);
                if (getter == null) return false;
                if (!getter.IsPublic) return false;
            }

            // Reject non-public fields
            if (field != null && !field.IsPublic) return false;

            // Reject even public fields of a Component - we don't want to encourage using them, since Duality basically works with Properties.
            if (field != null && typeof(Component).IsAssignableFrom(info.DeclaringType)) return false;

            // Reject explicitly invisible members
            if (flagsAttrib != null && (flagsAttrib.Flags & MemberFlags.Invisible) != MemberFlags.None) return false;

            return true;
        }
开发者ID:ruzli,项目名称:duality,代码行数:31,代码来源:DualitorPropertyGrid.cs

示例3: EditorMemberPredicate

		private bool EditorMemberPredicate(MemberInfo info)
		{
			if (this.ShowNonPublic)
			{
				// Show member, if not declared inside Duality itself
				if (info.DeclaringType.Assembly != typeof(DualityApp).Assembly) return true;

				// Reject non-public fields
				FieldInfo field = info as FieldInfo;
				if (field != null && !field.IsPublic) return false;

				// Reject non-public properties
				PropertyInfo property = info as PropertyInfo;
				if (property != null && property.GetGetMethod(false) == null && property.GetSetMethod(false) == null) return false;
			}
			else
			{
				// Don't show fields of a Component - we don't want to encourage using them, since Duality basically works with Properties.
				if (info is FieldInfo && typeof(Component).IsAssignableFrom(info.DeclaringType)) return false;
			}

			// Reject invisible members
			EditorHintFlagsAttribute flagsAttrib = info.GetEditorHint<EditorHintFlagsAttribute>();
			if (flagsAttrib != null && (flagsAttrib.Flags & MemberFlags.Invisible) != MemberFlags.None) return false;

			return true;
		}
开发者ID:Banbury,项目名称:duality,代码行数:27,代码来源:DualitorPropertyGrid.cs


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