string vb.net中结构中的列表(字符串)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3714158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
List(of String) in structure in vb.net
提问by Eugene
How would I make use of a List(of String) in a structure in vb.net. for example
我将如何在 vb.net 的结构中使用 List(of String)。例如
Structure examplestrut
Public exampleslist As List(Of String)
End Structure
How would I call exampleslist.add("example 1")?
我将如何调用 exampleslist.add("example 1")?
回答by SLaks
Like this:
像这样:
Dim myStruct as ExampleStruct
myStruct.exampleList = new List(Of String)()
myStruct.exampleList.Add("Hi there!")
回答by Tim Makins
Its also worth mentioning that if you already have a 'myStruct' declared earlier in the program and you need to empty it, you use
还值得一提的是,如果您已经在程序前面声明了一个“myStruct”并且您需要清空它,您可以使用
myStruct.exampleList = new List(Of String)()
rather than
而不是
myStruct.exampleList.Clear()