【发布时间】:2010-09-25 05:02:42
【问题描述】:
这是一个有趣的谜题。
我下载了 Snippet Compiler 来尝试一些东西,并想编写以下代码:
using System;
using System.Collections.Generic;
public class MyClass
{
public static void RunSnippet()
{
HashSet<int> h = new HashSet<int>();
}
}
但是上面的代码不能编译。我明白了:
"类型或命名空间名称'HashSet' 找不到(您是否缺少 使用指令或程序集 参考?)”
显然我不是。它似乎找不到 HashSet,但它在 Systems.Collections.Generic 命名空间中找到了其他类型(例如 List、SortedDictionary)。
对此有何解释?大概 Snippet Compiler 只是在幕后使用标准的 Framework 编译器......
我很想知道为什么这不起作用。
【问题讨论】:
-
太棒了! 3.5 的 SnippetCompiler 已发布!如果我没有看到你的问题,我永远不会检查!
-
很高兴通过提出愚蠢的问题来提供帮助! :)
标签: c# .net .net-3.5 code-snippets