title: how to do masking/hiding email address in c#
body: <p>i have an issue, i have to apply masking/hiding part of email address in c#. example</p>
  
  <pre><code>jhon@abc.com==&gt; jh**n@abc.com
  bigjhon@abc.com==&gt; bi****n@abc.com
  brotherhood@abc.com==&gt;br*******od@abc.com
  </code></pre>
  
  <p>i have this code but its giving exception for some emails. "Index was outside the bounds of the array."</p>
  
  <pre><code>for (int i = 0; i &lt; eml.Length; i++)
  {
   int j = i == (eml.Length - 1) ? 0 : 1;
   cc = eml[i].ToString();
   if (i &lt;= 1)
   {
    dispeml += cc;
   }
   else 
   if (eml[i + (j + k)].ToString() == "@")
   {
    dispeml += cc;
    k = 0;
    fl = 1;
   }
   else 
   if (eml[i + j].ToString() == "@")
   {
    dispeml += cc;
    fl = 1;
   }
   else 
   if (fl == 1)
   {
    dispeml += cc;
   }
   else
   {
    dispeml += "*";
   }
  }
  </code></pre>