title: How to RoundUp a decimal value with a base distinct from degree of 10?
body: <p>A regular RoundUp function with a base of 10 looks as below:</p>
  
  <pre><code>public static decimal RoundUp(this decimal value, int decimals)
          {
              var k = (decimal)Math.Pow(10, decimals);
              return Math.Ceiling((value * k)) / k;
          }
  </code></pre>
  
  <p>so it works like this:</p>
  
  <pre><code>decimal number = 10.12345m;
  number.RoundUp(3) =&gt; 10.124
  number.RoundUp(2) =&gt; 10.13
  number.RoundUp(1) =&gt; 10.2 
  etc.
  </code></pre>
  
  <p>I would like to have a function that rounds up to the nearest value as the following:</p>
  
  <pre><code>decimal number = 10.12345m;
  number.RoundUp(0.1) =&gt; 10.2          
  number.RoundUp(0.25) =&gt; 10.25 
  number.RoundUp(2.0) =&gt; 12
  number.RoundUp(5.0) =&gt; 15 
  number.RoundUp(10) =&gt; 20 
  </code></pre>
  
  <p>Note RoundUp by @basis means the result is dividable on the @basis without the rest:</p>
  
  <pre><code>RoundUp(10.12345m, 0.15) =&gt; 10.2   check 10.2 / 0.15 = 68 
  </code></pre>
  
  <p>neighbors are 10.05 and 10.35, so the correct rounding of 10.12345 is 10.2</p>
  
  <pre><code>RoundUp(5, 2.25) =&gt; 6.75   check 6.75 / 2.25 = 3
  </code></pre>
  
  <p>i.e. 2.25x2 =4.50 is less than 5. so 5 round up by 2.25 will be 6.75 </p>
  
  <pre><code>RoundUp(5, 2.50) =&gt; 5.0   check 5 / 2.5 = 2 
  </code></pre>