Files
DP44/Common/DTS.CommonCore/Base/Classes/BasePropertyChanged.cs
2026-04-17 14:55:32 -04:00

26 lines
737 B
C#

using System;
using System.ComponentModel;
// ReSharper disable CheckNamespace
namespace DTS.Common.Base
{
public abstract class BasePropertyChanged : IBasePropertyChanged
{
public virtual event PropertyChangedEventHandler PropertyChanged;
public bool SetProperty<T>(ref T storage, T value, String propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
public virtual void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}