converting vb.net code into c#
salam sir i want to convert the following vb.net code into csharp...
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class clsDML
Public conn As SqlConnection
Public Function DML(ByVal Query As String)
Try
Dim connectionstring As String
connectionstring = CreateConnection()
conn = New SqlConnection(connectionstring)
conn.Open()
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.Text
cmd.CommandText = Query
cmd.ExecuteNonQuery()
conn.Close()
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Function
Public Function GetArray(ByVal Query As String, Optional ByVal LocalServer As String = "")
Try
Dim connectionstring As String
connectionstring = CreateConnection()
conn = New SqlConnection(connectionstring)
conn.Open()
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandText = Query
Dim data As SqlDataReader = cmd.ExecuteReader() 'reader = command.ExecuteReader();
Dim i, j, x As Int32
While (data.Read())
i = i + 1
End While
Dim count As Int32
Dim A(i - 1, data.FieldCount - 1)
count = data.FieldCount
data.Close()
Dim data1 As SqlDataReader = cmd.ExecuteReader()
j = 0
While (data1.Read())
For x = 0 To count - 1
A(j, x) = data1.GetValue(x).ToString()
Next
j = j + 1
End While
data1.Close()
Return A
Catch ex As Exception
End Try
End Function
Public Function CreateConnection() As String
Dim source As String
source = "data source=(local);database=mdin;user id=sa; pwd=;Persist Security Info=False"
Return source
End Function
End Class