Hola, estoy pasando un codigo de vb a c# y me sale una excepcion en este lugar
codigo vb:
Public Function SplitString(ByVal TheString As String, ByVal StringLen As Integer) As String()
Dim ArrCount As Integer 'as it is declared locally, it will automatically reset to 0 when this is called again
Dim I As Long 'we are going to use it.. so declare it (with local scope to avoid breaking other code)
Dim TempArray() As String
ReDim TempArray((Len(TheString) - 1) \ StringLen)
For I = 1 To Len(TheString) Step StringLen
TempArray(ArrCount) = Mid$(TheString, I, StringLen)
ArrCount = ArrCount + 1
Next
SplitString = TempArray 'actually return the value
End Function
codigo c#
int Arrcount
= new int(); long I;
string[] TempArray
= new string[(TheString
.Length -1) / (StringLen
) + 1]; for (I = 1; I <= TheString.Length; I += StringLen)
{
TempArray[Arrcount] = Strings.Mid(TheString, Convert.ToInt32(I), StringLen);
Arrcount++;
}
return TempArray;
la excepcion me sale aqui en c#
string[] TempArray = new string[(TheString.Length -1) / (StringLen) + 1];
y es :
Excepción no controlada del tipo 'System.DivideByZeroException' en Kuroi Crypter.exe
Información adicional: Attempted to divide by zero.