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