I want to replace below code into c#. Right("00" & ds.Tables[0].Rows[0]["KEY_NAME_VALUE"].ToString() + 1, 3)
Doesn't exist in C# from my knowledge
try
String.Substring(ds.Tables[0].Rows[0]["KEY_NAME_VALUE"].ToString().Length - 3)
Or you could use this function from Microsoft.VisualBasic
Public Function Right(ByVal [str] As String, ByVal Length As Integer) As String
If Length < 0 Then
Throw New ArgumentException(GetResourceString(ResID.Argument_GEZero1, "Length"))
End If
If Length = 0 OrElse [str] Is Nothing Then
Return ""
End If
Dim lStrLen As Integer
lStrLen = [str].Length
If Length >= lStrLen Then
Return [str]
End If
Return [str].Substring(lStrLen - Length, Length)
End Function
http://referencesource.microsoft.com/#Microsoft.VisualBasic/Strings.vb,0dbb15fffce19341
but then you would be relying on having Microsoft.VisualBasic
namespace I suppose.