日期:2014-05-19  浏览次数:20856 次

vb.net中collection如何转换到C#
Dim     d     As     New     Collection    
                              d.Add( "Northsnow ")    
                              d.Add( "塞北的雪 ")    
                              d.Add( "http://blog.csdn.net ")    
                              Dim     t     As     New     ArrayList(d)    
                              Dim     sb     As     New     System.Text.StringBuilder()    
                              If     t.Count     >     0     Then    
                                              sb.Append( "ArrayList中共有     成员     ")    
                                              sb.Append(t.Item(2).ToString)    
                                              sb.Append( "     个 ")    
                                              For     Each     aa     As     String     In     t    
                                                              sb.AppendLine()    
                                                              sb.Append(aa)    
                                              Next    
                              End     If    
                              MsgBox(sb.ToString)    
 
以上是使用ARRAYLIST存储一个集合,VB中可以使用collectin,将其传入arraylist,而在C#中如何定义这个东西,使他能够传入ARRAYLIST呢?给个例子,谢谢

------解决方案--------------------
1。
// 事实上你可以直接在 C# 中使用 Microsoft.VisualBasic.Collection
// 需要添加对 Microsoft.VisualBasic.dll 的引用
Microsoft.VisualBasic.Collection d = new Microsoft.VisualBasic.Collection();
d.Add( "Northsnow "