array handling and vb .net to c# translation help
I am new to C# and I would like to know how to handle array in C#. Here's the code I wrote in vb .net. I got stuck when I tried to translated it to C#. Could someone help?
Code:
Sub Main()
Randomize()
Dim randNum(45) As Integer ' counters
Dim randGen As New Random(DateTime.Now.Millisecond) ' random generator
Dim randInd As Integer = 0 ' loop counter
Dim intTemp As Int16 = 0
'Start...
For randInd = 1 To 2000
randNum(randGen.Next(1, 46)) += 1 ' increment counter
Next
Console.WriteLine("Numbers Times")
Console.WriteLine("======= =====")
For randInd = 1 To 45
Console.WriteLine(randInd.ToString().PadLeft(3) + " " + randNum(randInd).ToString())
Next
'Most frequent randomized number:
Dim temp As String
'Dim memory As String
Dim check As Int16
Dim checkTime As Int16
checkTime = 7
Console.WriteLine("")
Console.WriteLine("The top 7 most frequent randomized numbers are:")
Console.WriteLine("")
For check = 1 To checkTime
For randInd = 1 To 45
If randNum(randInd) = intTemp Then
If temp.Length <> 0 Then
temp = temp + " & " + randInd.ToString()
'memory = randInd.ToString()
Else
temp = randInd.ToString()
'memory = randInd.ToString()
End If
ElseIf randNum(randInd) > intTemp And randNum(randInd) <> intTemp Then
intTemp = randNum(randInd)
temp = randInd.ToString()
'memory = randInd.ToString()
End If
Next
For randInd = 1 To 45
If randNum(randInd) = intTemp Then randNum(randInd) = 0
Next
Console.WriteLine(temp.PadLeft(25) + ": " + intTemp.ToString() + " times") 'Write the top numbers
intTemp = 0
Next check
Console.WriteLine("")
Console.WriteLine("Press any key to continue")
Console.ReadLine()
End Sub