Converting from C to C#
I need help to get this C function to work in c#.
        
    ULONG MsgCountCheckSumTwo(UBYTE *buf, ULONG begin, ULONG end)
    {
    ULONG i, check_sum;
    
    check_sum = 0;
    if (end >= begin)
    {
    i = end - begin;
    buf += begin;
    while(i--)
    {    
        check_sum += *buf++;          
    }
    }
    return check_sum;
    }

Converting from C to C#
===

I need help to get this C function to work in c#.
        
    ULONG MsgCountCheckSumTwo(UBYTE *buf, ULONG begin, ULONG end)
    {
    ULONG i, check_sum;
    
    check_sum = 0;
    if (end >= begin)
    {
    i = end - begin;
    buf += begin;
    while(i--)
    {    
        check_sum += *buf++;          
    }
    }
    return check_sum;
    }
