如何在vb.net中在运行时动态创建数组变量 [英] How to Dynamically Create Array Variable at runtime in vb.net

查看:373
本文介绍了如何在vb.net中在运行时动态创建数组变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想在运行时动态创建一个数组变量,这就是我到目前为止所用的内容

< pre lang =vb> Dim 变量 As New 字典( 字符串整数)()
Dim MyVar As String = DynamicVariable

For i As 整数 = 1 10
变量(MyVar& i.ToString)= i
下一步

解决你无法创建一个变量,你可以创建一个数组对象: Dim myArray()As Char = New Char(12){} ,例如。



我认为它不能真的帮助你。你不是想编程或学习编程;你正在做一些你根本不知道的事情。你真的需要阅读一些基础手册,并尝试学习基础知识,首先。使用.NET,您至少应该了解变量,类型,类型成员,引用,引用类型与值类型,装箱,方法,方法参数及其传递等等。



-SA


Hi

I Want to create a an array variable on the fly during runtime and this is what I have so far

Dim variables As New Dictionary(Of String, Integer)()
Dim MyVar As String = "DynamicVariable"

   For i As Integer = 1 To 10
       variables(MyVar & i.ToString) = i
   Next

解决方案

You cannot create a "variable", you can create an array object: Dim myArray() As Char = New Char(12) {}, for example.

I don''t think it can really help you. You are not trying to program or learn programming; you are just doing something you have no idea about. You really need to read some elementary manual and try to learn the very basics, to start with. And with .NET, you should at least understand variables, types, type members, references, reference types vs value types, boxing, methods, method parameters and their passing, and more.

—SA


这篇关于如何在vb.net中在运行时动态创建数组变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆