G
Guest
Can someone help me convert thi to c# or vb.net
Calculate()
{
int i, nLen, nSum = 0, nItem;
nLen = m_csMessage.GetLength();
for (i = 0 ; i < nLen ; i++){
nItem = i%2 ? ((int)m_csMessage.GetAt(i)-48)*1 :
((int)m_csMessage.GetAt(i)-48)*3;
nSum += nItem;
}
nSum %= 10;
return (10-nSum)%10;
}
Thanks
Calculate()
{
int i, nLen, nSum = 0, nItem;
nLen = m_csMessage.GetLength();
for (i = 0 ; i < nLen ; i++){
nItem = i%2 ? ((int)m_csMessage.GetAt(i)-48)*1 :
((int)m_csMessage.GetAt(i)-48)*3;
nSum += nItem;
}
nSum %= 10;
return (10-nSum)%10;
}
Thanks