rajendradhakal 0 Newbie Poster

Previously i've done it in VB6 in following ways:
for lock database

Sub lockDb(bPath As String)
    On Error GoTo Ermsg
    Dim iFreeFile   As Integer
    Dim lLoop       As Integer
    Dim sString     As String

    iFreeFile = FreeFile() 'Get free file #
    Open bPath For Binary As #iFreeFile 'Open specified file for binary I/O.

    sString = "windows database" 'Default header data.

    For lLoop = 7 To 19 'loop through and update byte positions 9 through 15.
        Put #iFreeFile, lLoop, VBA.Mid$(sString, lLoop - 4, 1)
    Next lLoop
'    If cmdunlock.Enabled = False Then cmdunlock.Enabled = True
'
'    cmdlock.Enabled = False
Close #iFreeFile

for open database

Sub UnlockDb(bPath As String)
    On Error GoTo Ermsg
    Dim iFreeFile   As Integer
    Dim lLoop       As Integer
    Dim sString     As String
    iFreeFile = FreeFile() 'Get free file #
    Open bPath For Binary As #iFreeFile 'Open specified file for binary I/O.

    sString = "Standard Jet DB" 'Default header data.

    For lLoop = 7 To 19 'loop through and update byte positions 9 through 15.
        Put #iFreeFile, lLoop, VBA.Mid$(sString, lLoop - 4, 1)
    Next lLoop
    Close #iFreeFile

i've to do this in C#
How can i do this