【问题标题】:Shorten commands?缩短命令?
【发布时间】:2009-12-06 06:49:51
【问题描述】:

是否可以缩短命令,例如...

this.ExampleCommand1.ExampleCommand2.1;
this.ExampleCommand1.ExampleCommand2.2;
this.ExampleCommand1.ExampleCommand2.3;

ExampleShorten = "this.ExampleCommand1.ExampleCommand2";
ExampleShorten.1;
ExampleShorten.2;
ExampleShorten.3;

?

【问题讨论】:

  • 这是什么代码?什么是“命令”?
  • 你怎么会访问一个名为123的成员?

标签: c# command


【解决方案1】:
var ExampleShortened = this.ExampleCommand1.ExampleCommand2;
ExampleShortened.1;
ExampleShortened.2;
ExampleShortened.3;

【讨论】:

  • 谢谢!我永远无法弄清楚该类型应该是什么。
  • 有没有办法全局宣布变量?我尝试将它放在类下,但 var 是未知类型。
  • 如果您使用的是 Visual Studio,只需越过 ExampleCommand2 部分,智能感知就会告诉您类型。
猜你喜欢
  • 2020-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-08-03
  • 2022-10-17
  • 2018-09-22
  • 2019-07-18
相关资源
最近更新 更多