本文介绍了为字符串创建动态名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的数据库的一行创建一个字符串,但是对于每一行,我需要一个新的

字符串和变量的新名称。


例证:

int i = myRow [" ID"];

string varName =" news";


createNameVar = varName + i;


但是我不能在C#中评估这个,还有字符串news1,new2,...,newsN不要

存在。

我怎么能这样做?

I want create a string from a row of my db, but for each rows i need a new
string and a new name for the variable.

exemple:
int i = myRow["ID"];
string varName = "news";

createNameVar = varName + i;

but i can''t eval this in C#, also the strings news1, new2,...,newsN don''t
exist.
How i can do that?

推荐答案




为什么需要变量的新名称?为什么不使用数组呢?


-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该组,请不要给我发邮件



Why do you need a new name for the variable? Why not just use an array?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too




因为我使用字符串在Macromedia Flash

界面中发送变量。


Because i use the string to send the variable in a Macromedia Flash
interface.



这篇关于为字符串创建动态名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 23:06
查看更多