本文整理汇总了C#中System.Security.Policy.Evidence.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Evidence.ToString方法的具体用法?C# Evidence.ToString怎么用?C# Evidence.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Policy.Evidence
的用法示例。
在下文中一共展示了Evidence.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
try
{
int value;
while (true)
{
Console.WriteLine("\nSpecify Zone: ");
Console.WriteLine("\t1. " + SecurityZone.Internet);
Console.WriteLine("\t2. " + SecurityZone.Intranet);
Console.WriteLine("\t3. " + SecurityZone.MyComputer);
Console.WriteLine("\t4. " + SecurityZone.Trusted);
Console.WriteLine("\t5. " + SecurityZone.Untrusted);
Console.WriteLine("\tType q to exit");
Console.Write("\nEnter a selection: ");
string input = Console.ReadKey().KeyChar.ToString();
if (input.ToLowerInvariant().Equals("q"))
return;
bool parsed = Int32.TryParse(input, out value);
if (parsed)
{
if (value > 0 && value <= 5)
break;
}
Console.WriteLine("Please enter a valid value.");
}
SecurityZone zone = SecurityZone.Internet;
switch (value)
{
case (1): zone = SecurityZone.Internet; break;
case (2): zone = SecurityZone.Intranet; break;
case (3): zone = SecurityZone.MyComputer; break;
case (4): zone = SecurityZone.Trusted; break;
case (5): zone = SecurityZone.Untrusted; break;
}
object[] hostEvidence = { new Zone(zone) };
Evidence e = new Evidence(hostEvidence, null);
AppDomain appDomain = AppDomain.CreateDomain("Malware Domain", e);
appDomain.ExecuteAssembly("Malware.exe");
Console.WriteLine("\nAssembly executed successfully.");
}
catch (Exception e)
{
Console.WriteLine("Exception: " + e.ToString());
}
}