此函数在一个线程中运行:
private void uReadBinaryDataset()
{
using (StreamReader sr = new StreamReader(m_sFileName))
{
using (BinaryReader br = new BinaryReader(sr.BaseStream))
{
long read = 0;
long count = br.BaseStream.Length;
while (read < count)
{
long ticks = br.ReadInt64();
float fv1 = br.ReadSingle();
float fv2 = br.ReadSingle();
this.Dispatcher.BeginInvoke((Action)delegate
{
liDataSet.Add(new DataFormat(ticks, fv1, fv2));
});
read += sizeof(long) + 2 * sizeof(float);
}
}
}
}
liDataSet是一个ObservableCollection,uReadBinaryDataset是我的wpf窗口的成员 这给了这个例外
未处理的类型&#39; System.OutOfMemoryException&#39;发生在mscorlib.dll