How to convert ReDim?

1365 views c#
5

I want to translate vb code to C# with code ReDim problem. I use convertor online but can't work for this case. Someone know to to translate it.

        Private bytIV() As Byte = _
        {12, 241, 10, 21, 90, 74, 11, 39, 9, 91, 45, 78, 189, 211, 133, 62, 121, 22, 101, 34, 90, 74, 121, 39, 93, 9, 45, 78, 1, 211, 33, 162}

       If (_CryptoService.LegalBlockSizes.Length > 0) Then
            Dim maxSize As Integer = _CryptoService.LegalBlockSizes(0).MaxSize
            ReDim Preserve bytIV(sTemp.Length - 1)
            If sTemp.Length * 8 > maxSize Then
                ReDim Preserve bytIV(maxSize / 8 - 1)
            End If
        End If

What does bytIV() exactly use for in Encrypt job?

how to translate ReDim in Csharp?

Much thanks.

answered question

1 Answer

3

The closest thing available in C# is Array.Resize, which is standard .NET and thus available in VB too. You might like to try using it in the VB code to see whether you get the same result first, then the translation to C# will be easier.

More to follow...

posted this

Have an answer?

JD

Please login first before posting an answer.