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


C# PropertyInfo.IsEquivalent方法代码示例

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


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

示例1: OnPropertySet

 protected override void OnPropertySet(PropertyInfo property, IEnumerable<object> targets)
 {
     base.OnPropertySet(property, targets);
     if (property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimCols) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimRows) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_AnimFrameBorder) ||
         property.IsEquivalent(ReflectionInfo.Property_Pixmap_Atlas))
     {
         this.PerformGetValue();
         (this.ParentEditor as PixmapPropertyEditor).UpdatePreview();
     }
 }
开发者ID:SirePi,项目名称:duality,代码行数:12,代码来源:PixmapContentPropertyEditor.cs

示例2: PushChange

        /// <summary>
        /// Creates a new change list entry.
        /// </summary>
        /// <param name="target">The target object in which the change has been made. Must be a GameObject or Component.</param>
        /// <param name="prop">The target objects <see cref="System.Reflection.PropertyInfo">Property</see> that has been changed.</param>
        /// <param name="value">The value to which the specified Property has been changed to.</param>
        public void PushChange(object target, PropertyInfo prop, object value)
        {
            if (prop.IsEquivalent(ReflectionInfo.Property_GameObject_Parent)) return; // Reject changing "Parent" as it would destroy the PrefabLink
            if (!prop.CanWrite) return;
            if (this.changes == null) this.changes = new List<VarMod>();

            GameObject targetObj = target as GameObject;
            Component targetComp = target as Component;
            if (targetObj == null && targetComp != null) targetObj = targetComp.gameobj;

            if (targetObj == null)
                throw new ArgumentException("Target object is not a valid child of this PrefabLinks GameObject", "target");
            if (value == null && prop.PropertyType.IsValueType)
                throw new ArgumentException("Target field cannot be assigned from null value.", "value");
            if (value != null && !prop.PropertyType.IsInstanceOfType(value))
                throw new ArgumentException("Target field not assignable from Type " + value.GetType().Name + ".", "value");

            VarMod change;
            change.childIndex		= this.obj.IndexPathOfChild(targetObj);
            change.componentType	= (targetComp != null) ? targetComp.GetType() : null;
            change.prop				= prop;
            change.val				= value;

            this.PopChange(change.childIndex, prop, change.componentType);
            this.changes.Add(change);
        }
开发者ID:ninja2003,项目名称:duality,代码行数:32,代码来源:Prefab.cs


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