using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public static class DoubleExtensions
{
///
/// Replaces the decimal part of this value and returns a new value.
///
/// The value.
/// The value to take the decimal part from.
///
public static double ReplaceDecimalPart(this double value, double fromValue)
{
decimal right = (decimal)fromValue - Math.Truncate((decimal)fromValue);
double result = (double)(Decimal.Truncate((decimal)value) + right);
return result;
}
}