有段代码因为是用VB编写的,我想转成C#。发现dim strdata as string=space(1024)这条语话在C#中是没有space方法的,哪位大神可以给解答或者给个例子参考一下不胜感激。
Public Function Read(ByVal SectionName As String, ByVal KeyName As String) As String
Dim intRetVal As Int32
Dim strData As String = Space(1024)
Try
intRetVal = GetPrivateProfileString(SectionName, KeyName, Nothing, strData, strData.Length, _INIFileName)
If intRetVal > 0 Then
Read = strData.Substring(0, intRetVal)
Else
Read = ""
End If
Catch
Read = ""
End Try
End Function如果没明白意思,上面这个VB代码用C#该怎样写。分不多在此谢谢各位了
Public Function Read(ByVal SectionName As String, ByVal KeyName As String) As String
Dim intRetVal As Int32
Dim strData As String = Space(1024)
Try
intRetVal = GetPrivateProfileString(SectionName, KeyName, Nothing, strData, strData.Length, _INIFileName)
If intRetVal > 0 Then
Read = strData.Substring(0, intRetVal)
Else
Read = ""
End If
Catch
Read = ""
End Try
End Function如果没明白意思,上面这个VB代码用C#该怎样写。分不多在此谢谢各位了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货