title: multiple chaining extension method in Aspose Cells
body: <p>I just found the use of extension methods (new to this concept).Then I started using it immediately for understanding.</p>
  
  <p>I am actually using Aspose cells product for creating Excel sheets which is really good one.</p>
  
  <p>Please find code below first.</p>
  
  <pre class="lang-cs prettyprint-override"><code>//Extension method
  public static Range ToPercentage(this Range range,int number)
  {
      var style = new Style();
      var styleFlag = new StyleFlag();
      style.Number = number;
      styleFlag.NumberFormat = true;
      range.ApplyStyle(style, styleFlag);
      return range;
  } 
  </code></pre>
  
  <p>Then in my code I am using this as </p>
  
  <pre><code>range.ToPercentage(10);
  </code></pre>
  
  <p>So far, so good, but <code>ToPercentage</code> can be used on just one cell like </p>
  
  <pre><code>cell.ToPercentage(); //Can't do because this is Range not cell.
  </code></pre>
  
  <p>There are also other formats I need to consider and order of arrival is not important. It means I can write something like</p>
  
  <pre class="lang-none prettyprint-override"><code>Case 1:(a)range.ToPercentage(10).SetBold(true)
         (b)cell.ToPercentage(10).SetBold(true)
              or
  Case 2:(a)range.SetBold(true).ToPercentage(10)
         (b)cell.SetBold(true).ToPercentage(10)
  </code></pre>
  
  <p><strong>So problem is return type.</strong></p>
  
  <pre class="lang-none prettyprint-override"><code>In case 1(a)- ToPercentage(10) return type is range  
           (b)- ToPercentage(10) return type is cell.  
  </code></pre>
  
  <p>Same problem with order of arrival of these methods in case 2.</p>
  
  <p>What is correct solution to this? In the future return type could be anything, it depends on the requirement of report in excel format and in excel we can logically apply many rules one upon other or together.</p>
  
  <p>I am new to development (getting familiar with intermediate and advanced concepts).</p>