【问题标题】:Is "static class imports" actually an announced or hinted at future feature of C#? [closed]“静态类导入”实际上是 C# 未来功能的宣布或暗示吗? [关闭]
【发布时间】:2012-06-13 07:31:51
【问题描述】:

this edit 开始,Wikipedia article on C# 提到“静态类导入”作为 C# 的未来功能,以及“编译器即服务 (“Roslyn”)”。

编译器团队的成员是否真的宣布或暗示过此功能,还是只是胡乱猜测?

【问题讨论】:

标签: c# static-import


【解决方案1】:

Eric Lippert made a post about this feature 但他没有承诺实施。

【讨论】:

    【解决方案2】:

    the Eric Lippert's article that's most likely the source of this 中,他正在讨论使用 C# 作为脚本语言。而且,Roslyn CTP 包括 C# 交互窗口和 C# 脚本引擎。

    C# Interactive 使用稍微不同的 C# 版本。例如,您并不总是需要分号,您可以拥有顶级方法和顶级语句。您还可以使用静态类导入:

    > using System.Math;
    > Abs(-5)
    5
    

    因此,我认为静态类导入(以及我提到的其他“脚本”功能)不会包含在 C# 的正常版本中,但您可以在 C# 脚本中使用它们。

    【讨论】:

      猜你喜欢
      • 2014-06-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-02
      • 1970-01-01
      • 2019-11-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多