Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# System.IO.EndOfStreamException_C#_C# 4.0 - Fatal编程技术网

C# System.IO.EndOfStreamException

C# System.IO.EndOfStreamException,c#,c#-4.0,C#,C# 4.0,朋友们,我有一个名为Vector.bin的二进制文件,当我试图加载它进行读取时,收到了错误消息 System.IO.EndOfStreamException其他信息:无法读取流结尾以外的内容 我是C#新手,不懂高级C#。请提出这方面可能的解决办法。读取“decoder.LoadModel(filename);”时引发错误 下面是我代码的一些部分 public WordEMWrapFeaturizer(string filename) { WSDSharp.Decoder decoder

朋友们,我有一个名为Vector.bin的二进制文件,当我试图加载它进行读取时,收到了错误消息

System.IO.EndOfStreamException其他信息:无法读取流结尾以外的内容

我是C#新手,不懂高级C#。请提出这方面可能的解决办法。读取“decoder.LoadModel(filename);”时引发错误
下面是我代码的一些部分

public WordEMWrapFeaturizer(string filename)
{
    WSDSharp.Decoder decoder = new WSDSharp.Decoder();
    decoder.LoadModel(filename);
    string[] terms = decoder.GetAllTerms();
    vectorSize = decoder.GetVectorSize();
   m_WordEmbedding = new Dictionary<string, Vector>();
    m_UnkEmbedding = new Vector(vectorSize);
}
public-wordemwrapfeaturer(字符串文件名)
{
WSDSharp.Decoder Decoder=新的WSDSharp.Decoder();
decoder.LoadModel(文件名);
string[]terms=decoder.GetAllTerms();
vectorSize=解码器。GetVectorSize();
m_WordEmbedding=新字典();
m_=新向量(向量大小);
}

您确定您的文件格式正确且未损坏吗?@Diligent我认为其格式正常,一种快速测试方法是使用System.IO类示例文件加载文件。ReadAllText(文件名);如果这也失败了,那么您的文件肯定已损坏/damaged@Viru,好的,我正在尝试你提到的程序。谢谢