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


C# FieldInfo.GetCustomAttributes方法代码示例

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


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

示例1: GetFor

 /// <summary>
 /// Gets the UTConnectorHint attached to the given field.
 /// </summary>
 public static UTConnectorHint GetFor(FieldInfo field)
 {
     var hints = field.GetCustomAttributes(typeof(UTConnectorHint), true);
     if (hints.Length > 0) {
         return (UTConnectorHint) hints[0];
     }
     return new UTConnectorHint();
 }
开发者ID:realshyfox,项目名称:PlayMakerCustomActions_U3,代码行数:11,代码来源:UTConnectorHint.cs

示例2: BuildFieldsString

 public static string BuildFieldsString(ref FieldInfo field)
 {
     string str = "no help";
     object[] customAttributes = field.GetCustomAttributes(true);
     for (int i = 0; i < (int)customAttributes.Length; i++)
     {
         object obj = customAttributes[i];
         if (obj is ConsoleSystem.Help)
         {
             str = (obj as ConsoleSystem.Help).helpDescription;
         }
     }
     return string.Concat(field.Name, " : ", str);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:14,代码来源:global.cs

示例3: GetPropertyDrawerForField

    public static PropertyDrawer GetPropertyDrawerForField(FieldInfo fInfo) {
        var drawer = Reflector.GetCustomPropertyDrawerFor(fInfo.FieldType, typeof(AbilityPage).Assembly);
        if (drawer != null) return drawer;
        var attrs = fInfo.GetCustomAttributes(false);
        if (attrs == null) return null;
        for (int i = 0; i < attrs.Length; i++) {
            drawer = Reflector.GetCustomPropertyDrawerFor(attrs[i].GetType(), typeof(AbilityPage).Assembly, typeof(EditorGUI).Assembly);
            if (drawer != null) {
                drawer.GetType()
                      .GetField("m_Attribute", BindingFlags.NonPublic | BindingFlags.Instance)
                      .SetValue(drawer, attrs[i]);
                return drawer;
            }
        }

        return drawer;
    }
开发者ID:weichx,项目名称:AbilitySystem,代码行数:17,代码来源:DrawerUtil.cs

示例4: ListField

    /// <summary>
    /// Binds a System.Collections.Generic.List of components to all the components of its type within the scope specified by the [Bind] attribute.
    /// Does nothing if the field is already non-null.
    /// </summary>
    /// <param name="component">Component containing the field</param>
    /// <param name="field">The field of the component to bind</param>
    /// <param name="elementType">Type of elements of the list.  Must be a subclass of BindingBehaviour.</param>
    private static void ListField(MonoBehaviour component, FieldInfo field, Type elementType)
    {
        if (field.GetValue(component) == null)
        {
            var bindAttributes = field.GetCustomAttributes(typeof(BindAttribute), true);
            switch (bindAttributes.Length)
            {
                case 0:
                    break;

                case 1:
                    BindListField(field, (BindAttribute)bindAttributes[0], component, elementType);
                    break;

                default:
                    throw new Exception(
                        String.Format("Multiple BindAttributes on field {0} of component {1}", field.Name, component.name));
            }
        }
    }
开发者ID:tzamora,项目名称:superteam,代码行数:27,代码来源:BindingBehaviour.cs

示例5: IsVisible

 /// <summary>
 /// Checks if the given field should be rendered or not.
 /// </summary>
 protected virtual bool IsVisible(FieldInfo field)
 {
     var delegateResult = rendererDelegate != null ? rendererDelegate.IsVisible (field) : UTVisibilityDecision.Undetermined;
     if (delegateResult == UTVisibilityDecision.Undetermined) {
         var hide = field.GetCustomAttributes (typeof(HideInInspector), true);
         return hide.Length == 0;
     }
     return delegateResult == UTVisibilityDecision.Visible;
 }
开发者ID:realshyfox,项目名称:PlayMakerCustomActions_U3,代码行数:12,代码来源:UTInspectorRenderer.cs

示例6: FieldPropertyDescriptor

		public FieldPropertyDescriptor(FieldInfo field) : base(field.Name,
        (Attribute[])field.GetCustomAttributes(typeof(Attribute), true))
		{
			_field = field;
		}
开发者ID:petya2164,项目名称:ZsharpGameEditor,代码行数:5,代码来源:FieldsProperties.cs

示例7: GetFor

 /// <summary>
 /// Gets the inspector hint annotation attached to a field. If no inspector hint is attached, a default hint is returned.
 /// </summary>
 /// <returns>
 /// The attached inspector hint.
 /// </returns>
 /// <param name='info'>
 /// The field information object.
 /// </param>
 public static UTInspectorHint GetFor(FieldInfo info)
 {
     var hints = info.GetCustomAttributes (typeof(UTInspectorHint), true);
     if (hints.Length > 0) {
         var hint = (UTInspectorHint)hints [0];
         return hint;
     }
     return Default;
 }
开发者ID:realshyfox,项目名称:PlayMakerCustomActions_U3,代码行数:18,代码来源:UTInspectorHint.cs

示例8: RequiresUnityPro

 public static bool RequiresUnityPro(FieldInfo fieldInfo)
 {
     return fieldInfo.GetCustomAttributes(typeof(UTRequiresUnityPro), true).Length > 0;
 }
开发者ID:realshyfox,项目名称:PlayMakerCustomActions_U3,代码行数:4,代码来源:UTRequiresUnityPro.cs

示例9: GetFor

 /// <summary>
 /// Gets the UTDoc attached to the given field.
 /// </summary>
 /// <returns>
 /// The UTDoc or a new UTDoc using a  default title and description, if there is no UTDoc on the field.
 /// </returns>
 public static UTDoc GetFor(FieldInfo field)
 {
     var docs = field.GetCustomAttributes(typeof(UTDoc), false);
     return CheckAndFix(docs, ObjectNames.NicifyVariableName(field.Name));
 }
开发者ID:realshyfox,项目名称:PlayMakerCustomActions_U3,代码行数:11,代码来源:UTDoc.cs


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