2022-02-03 13:19:48 +00:00
|
|
|
namespace ASC.Api.Utils;
|
|
|
|
|
|
|
|
public static class Update
|
2020-04-20 12:54:13 +00:00
|
|
|
{
|
2022-02-03 13:19:48 +00:00
|
|
|
public static T IfNotEquals<T>(T current, T @new)
|
2020-04-20 12:54:13 +00:00
|
|
|
{
|
2022-02-03 13:19:48 +00:00
|
|
|
if (!Equals(current, @new)) return @new;
|
2022-01-31 16:36:51 +00:00
|
|
|
|
2022-02-03 13:19:48 +00:00
|
|
|
return current;
|
|
|
|
}
|
2020-04-20 12:54:13 +00:00
|
|
|
|
2022-02-03 13:19:48 +00:00
|
|
|
public static T IfNotEmptyAndNotEquals<T>(T current, T @new)
|
|
|
|
{
|
|
|
|
if (Equals(@new, default(T))) return current;
|
2020-04-20 12:54:13 +00:00
|
|
|
|
2022-02-03 13:19:48 +00:00
|
|
|
if (!Equals(current, @new)) return @new;
|
2022-01-31 16:36:51 +00:00
|
|
|
|
2022-02-03 13:19:48 +00:00
|
|
|
return current;
|
2020-04-20 12:54:13 +00:00
|
|
|
}
|
|
|
|
}
|