本文整理汇总了C#中ApartmentState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ApartmentState.ToString方法的具体用法?C# ApartmentState.ToString怎么用?C# ApartmentState.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApartmentState
的用法示例。
在下文中一共展示了ApartmentState.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProcessStartInfo
private ProcessStartInfo GetProcessStartInfo(ApartmentState state)
{
const string exeName = "RemoteScriptFactory.exe";
// The exe is located in the IronStudio install dir. The repl can't run though unless IronPython and IronRuby dlls are GAC'd.
string processBasePath = Path.GetDirectoryName(typeof(RemoteScriptFactory).Assembly.Location);
#if DEBUG
// While developing the tooling use an exe located in Bin\Debug as we don't GAC any dlls.
string devBinPath = Environment.GetEnvironmentVariable("DLR_ROOT");
if (devBinPath != null) {
devBinPath = Path.Combine(devBinPath, @"Bin\Debug");
if (File.Exists(Path.Combine(devBinPath, exeName))) {
processBasePath = devBinPath;
}
}
#endif
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.FileName = Path.Combine(processBasePath, exeName);
processInfo.CreateNoWindow = true;
// Set UseShellExecute to false to enable redirection.
processInfo.UseShellExecute = false;
// Redirect the standard streams. The output streams will be read asynchronously using an event handler.
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
processInfo.RedirectStandardInput = true;
processInfo.Arguments = state.ToString();
return processInfo;
}