私の理解では、Redim は に似ていList<T>
ます。この VB6 から C# への適切な変換を確実にするためのヘルプを使用できます。
Private Sub ParseString(sInput As String, sWords() As String, lCount As Long, sDel As String)
' Parses a delimited input string (sInput) on a single
' delimiter and returns the parsed words back in a
' string array sWords().
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' INPUTS:
' sInput - string to be parsed.
' sDel - Delimiter character.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' OUTPUTS:
' sWords() - dynamic string array containing the parsed words.
'
' lCount - long, returning the number of words parsed
'
' NOTES:
' If this subroutine is passed an empty string, it will
' return a lCount of 0 with one element in sWords().
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim lWordStart As Long
Dim lWordEnd As Long
Dim sTemp As String
Dim lParsedArraySize As Long
Dim lDelLen As Long
' Dim lStartM As Long
' Dim lEndM As Long
Dim lLength As Long
lDelLen = Len(sDel)
lLength = Len(sInput)
If sInput = "" Then
ReDim sWords(1 To 1) As String
lCount = 0
sWords(1) = ""
Exit Sub
End If
lParsedArraySize = 50
ReDim sWords(1 To lParsedArraySize) As String
lWordStart = 1
lCount = 1
Do
lWordEnd = InStr(lWordStart, sInput, sDel)
If lWordEnd = 0 Then
sTemp = Mid$(sInput, lWordStart)
If lCount > lParsedArraySize Then
ReDim Preserve sWords(1 To lCount) As String
End If
sWords(lCount) = sTemp
Exit Do
Else
sTemp = Mid$(sInput, lWordStart, lWordEnd - lWordStart)
'If sTemp <> "" Then
If lCount > lParsedArraySize Then
lParsedArraySize = lParsedArraySize + 50
ReDim Preserve sWords(1 To lParsedArraySize) As String
End If
sWords(lCount) = sTemp
lCount = lCount + 1
'End If
lWordStart = lWordEnd + lDelLen
End If
Loop
If lCount < lParsedArraySize Then
ReDim Preserve sWords(1 To lCount) As String
End If
この If ステートメントを C# に変換するにはどうすればよいですか? これまでのところ...
private void ParseString(string sInput, List<string> sWords, int lCount, string sDel)
{
int lWordStart;
int lWordEnd;
string sTemp;
int lParsedArraySize;
int lDelLen;
//int lStartM;
//int lEndM;
int lLength;
lDelLen = sDel.Length;
lLength = sInput.Length;
if(String.IsNullOrEmpty(sInput))
{
}
}