Convert C++ code function to C#
<p>I have to write algorithm for my job and I found some solutions in the Web, but it`s written on C++ and I need this on C#.</p>

<p>I`m not so good on c++ and I waste a lot of time in order to convert from one language to another, I almost finished but I have some trouble with this function</p>

<pre><code>double sprod_ss(SVECTOR *a, SVECTOR *b)      
{
    register double sum=0;
    register WORD *ai,*bj;
    ai=a-&gt;words;
    bj=b-&gt;words;
    while (ai-&gt;wnum &amp;&amp; bj-&gt;wnum) 
    {
       if(ai-&gt;wnum &gt; bj-&gt;wnum) 
       {
          bj++;
       }
       else if (ai-&gt;wnum &lt; bj-&gt;wnum) 
       {
          ai++;
       }
       else 
       {
           sum+=(ai-&gt;weight) * (bj-&gt;weight);
           ai++;
           bj++;
       }
    }
    return((double)sum);
}
</code></pre>

<p>Anybody could help me with conversation? 
Thanks a lot</p>
