defaultUsageProfilePath

defaultUsageProfilePath

本文介绍了尝试为流读取器初始化流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码:

试试
{

列表< UsageProfile>结果=新列表< UsageProfile>();
System.Reflection.Assembly装配= System.Reflection.Assembly.GetExecutingAssembly();

如果(defaultUsageProfilePath!=")
使用(StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(defaultUsageProfilePath)))
{
while(!reader.EndOfStream)
result.Add(新的UsageProfile(reader.ReadLine()));
}
返回结果;
}
catch(ex ex例外)
{
返回null;

}

它在
停止
使用(StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(defaultUsageProfilePath)))

它说:

值不能为空.\ r \ n参数名称:stream

I am using this code:

try
{

List<UsageProfile> result = new List<UsageProfile>();
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

if (defaultUsageProfilePath != "")
using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(defaultUsageProfilePath)))
{
while (!reader.EndOfStream)
result.Add(new UsageProfile(reader.ReadLine()));
}
return result;
}
catch (Exception ex)
{
return null;

}

and it is stopping on

using (StreamReader reader = new StreamReader(assembly.GetManifestResourceStream(defaultUsageProfilePath)))

and it is saying:

Value cannot be null.\r\nParameter name: stream

how can i initialize stream?

推荐答案



这篇关于尝试为流读取器初始化流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 10:29