mirror of
https://github.com/LorisYounger/VPet.ModMaker.git
synced 2024-08-30 18:22:21 +00:00
更新
This commit is contained in:
parent
1e7b3751ac
commit
c174ab1b13
@ -30,4 +30,54 @@ public class PropertyChangedXEventArgs : EventArgs
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// 获取值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <returns>(旧值, 新值)</returns>
|
||||
public (T oldValue, T newValye) GetValue<T>()
|
||||
{
|
||||
return ((T)OldValue!, (T)NewValue!)!;
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
/// 获取值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <returns>(旧值, 新值)</returns>
|
||||
public ValueInfo<T> GetValue<T>()
|
||||
{
|
||||
return new((T)OldValue!, (T)NewValue!)!;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NETCOREAPP2_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// 值信息
|
||||
/// </summary>
|
||||
/// <typeparam name="T">值类型</typeparam>
|
||||
public struct ValueInfo<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
public T OldValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
public T NewValue { get; set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
/// <param name="oldValue">旧值</param>
|
||||
/// <param name="newValue">新值</param>
|
||||
public ValueInfo(T oldValue, T newValue)
|
||||
{
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -32,4 +32,26 @@ public class PropertyChangingXEventArgs : CancelEventArgs
|
||||
OldValue = oldValue;
|
||||
NewValue = newValue;
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// 获取值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <returns>(旧值, 新值)</returns>
|
||||
public (T oldValue, T newValye) GetValue<T>()
|
||||
{
|
||||
return ((T)OldValue!, (T)NewValue!)!;
|
||||
}
|
||||
#else
|
||||
/// <summary>
|
||||
/// 获取值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">类型</typeparam>
|
||||
/// <returns>(旧值, 新值)</returns>
|
||||
public ValueInfo<T> GetValue<T>()
|
||||
{
|
||||
return new((T)OldValue!, (T)NewValue!)!;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user