关于C#字符串定义?
有段代码因为是用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#该怎样写。
分不多在此谢谢各位了
------解决方案--------------------
String s = new String(' ', 1024);