C# 基本格式问题
如果我想用变量交换语句的一部分,即
tempCube.transform.parent = row(var 需要放在这里,即用 for 循环迭代的 int).transform;
我该怎么写这个呢。抱歉,这个非常基本的问题,我使用其他语言太久了,现在我又回到了 c#,我几乎忘记了我学到的一切。
“(i)”是我想用变量交换的位,
例如
for(int i = 1; i <= 3; i++){ 打印行*(i)*.transform; }
:
(1,2,3) (2,3,4) (4,5,6)
If I wanted to swap out part of a statement with a variable i.e.
tempCube.transform.parent = row(var would need to go here ie an int that is iterated with a for loop).transform;
How would I write this. Sorry for the really basic question, I have been using other languages too long and now I have gone back to c# I have almost forgotten everything I had learned.
"(i)" is the bit I want to swap out with a variable
eg
for(int i = 1; i <= 3; i++){ print row*(i)*.transform; }
Console:
(1,2,3)
(2,3,4)
(4,5,6)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的意思是:-
如果是这样,不,您无法在运行时替换该文本。您应该使用集合。理想情况下,用它们制作一个 IEnumerable 并使用 foreach:-
You mean like:-
If so, no, you can't replace that text at runtime. You should use a collection. Ideally make an IEnumerable out of them and use foreach:-
我不确定你的意思,我希望你想指定索引,这就是你要找的(索引是你提到的 int )
I am not sure what you mean, i hope you want to specify the index, is this what you are looking for (index is the int you mentioned)