本文整理汇总了C#中IOutputWriter.WriteWarning方法的典型用法代码示例。如果您正苦于以下问题:C# IOutputWriter.WriteWarning方法的具体用法?C# IOutputWriter.WriteWarning怎么用?C# IOutputWriter.WriteWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOutputWriter
的用法示例。
在下文中一共展示了IOutputWriter.WriteWarning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeDirectoryCatalog
public SafeDirectoryCatalog(string folderLocation, IOutputWriter outputWriter)
{
if (outputWriter == null)
{
throw new ArgumentNullException("outputWriter");
}
// Make sure the directory actually exists
var directoryInfo = new DirectoryInfo(folderLocation);
if (directoryInfo.Exists == false)
{
throw new CompositionException(
"The specified folder does not exist: " + directoryInfo.FullName);
}
// Load each DLL found in the directory
foreach (var dllFile in directoryInfo.GetFileSystemInfos("*.dll"))
{
try
{
// Attempt to create an AssemblyCatalog for this DLL
var assemblyCatalog =
new AssemblyCatalog(
Assembly.LoadFile(
dllFile.FullName));
// We must call ToArray here to pre-initialize the Parts
// IEnumerable and cause it to be stored. The result is
// not used here because it will be accessed later once
// the composition container starts assembling parts.
assemblyCatalog.Parts.ToArray();
this.Catalogs.Add(assemblyCatalog);
}
catch (ReflectionTypeLoadException e)
{
// Write out the exception details and allow the
// loading process to continue
outputWriter.WriteWarning(e.ToString());
}
}
}