Dynamically create variables in VB.NET

后端 未结 3 1454
醉话见心
醉话见心 2021-01-06 01:04

I have been trying to figure this out for some time now and can\'t seem to figure out an answer to it. I don\'t see why this would be impossible. I am coding in VB.NET.

3条回答
  •  执念已碎
    2021-01-06 01:22

    You want to use a List

    Dim Numbers As New List(Of Integer)
    
    For i As Integer = 0 To 9 
        Numbers.Add(0)
    Next
    

    The idea of creating a bunch of named variables on the fly is not something you are likely to see in any VB.Net program. If you have multiple items, you just store them in a list, array, or some other type of collection.

提交回复
热议问题