public static implicit operator string[](StringList sl)
{
string[] sLHS = new string[sl.m_alMain.Count];
int index = 0;
while(index < sl.m_alMain.Count)
{
sLHS[index] = (string)sl.m_alMain[index];
index++;
}
return sLHS;
}
这段代码是函数还是什么,怎么没函数名的,用工具转成这样了,不对
Public Shared Widening Operator CType(ByVal sl As StringList) As String()
Dim sLHS As String() = New String(sl.m_alMain.Count - 1) {}
Dim index As Integer = 0
While index < sl.m_alMain.Count
sLHS(index) = DirectCast(sl.m_alMain(index), String)
index += 1
End While
Return sLHS
End Operator
------解决思路----------------------
这是强制转换操作符重载 意思是 StringList 类型通过 (string[]) 这样的转换
类拟 string[] xxx=(string[])StringListxxx
VB CType这是一个内部的方法名,是对的