Translate this vb.net Code to C #

-3

How could I translate this code to C #?

If TypeOf (ctrl) Is GridView AndAlso Not DirectCast(ctrl, GridView).HeaderRow Is Nothing Then
                Dim grid = DirectCast(ctrl, GridView)
                For i = 0 To (grid.HeaderRow.Cells.Count - 1)
                    Dim _nombre As String = grid.HeaderRow.Cells(i).Text
                    Dim _ctrlP As ControlPantalla = ControlesPantalla.Where(Function(x) x.Nombre = _nombre).FirstOrDefault()
                    If Not _ctrlP Is Nothing Then
                        grid.HeaderRow.Cells(i).Text = _ctrlP.Texto
                    End If
                Next
End If
    
asked by magi0 14.02.2018 в 16:50
source

1 answer

0

If it's not a lot of code you can do it using logic since each language works in a very similar way, otherwise you can use Telerik Code Converter .

Another method would be to use a descompilador for .NET and the code in most allows you to select to decompile code C# or code Visual Basic .NET

  • dotPeek
  • ILSpy
  • JustDecompile .NET
  • answered by 14.02.2018 в 20:35