2013-03-20 183 views
8

我目前正在为我的小型XNA项目编写一个自定义导入程序,并试图做一些简单的操作,如在我的导入程序Import方法中抛出FileFormatException无法使用FileFormatException(?)

我已经引用了WindowsBase.dll,所以FileFormatException应该在智能感知的System.IO下可用,对吧?我输入System.IO,并且在System.IO下没有自动完成FileFormatException

这里就是throw语句所在位置:

namespace TetrominoImporter 
{ 
    public class TetrominoReader : ContentImporter<Tetromino> 
    { 
     public const string blockFileName = "blocks.txt"; 

     public override Tetromino Import(string filename, ContentImporterContext context) 
     { 
      // HERE 
+0

好吧,我是一个完全白痴,谢谢你instream,我刚刚注意到我的OTHER(importer)项目没有引用WindowsBase,我的主要项目做了(这是没用的)。并且该代码位于导入器中。对不起,我觉得很蠢。这就像我看不到那个错误,因为它只是在我面前。 您能否将您的帖子设置为答案,S Grimminck,以便我接受它? (我认为它是如何工作的?)谢谢 – Toto 2013-03-20 20:46:03

回答

16

您需要包括WindowsBase在你的介绍人,为FileFormatException的是,集内定义。好了,我应该可以解决System.IO.FileFormatException