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