using System;
using System.Reflection;
public class Test
{
public static void Main()
{
Assembly assembly = Assembly.GetExecutingAssembly();
Console.WriteLine("\nEvidence: " + assembly.Evidence);
Console.WriteLine("\nEntry point: " + assembly.EntryPoint);
Console.WriteLine("\nIs in GAC: " + assembly.GlobalAssemblyCache);
Console.WriteLine("\nHostContext: " + assembly.HostContext);
Console.WriteLine("\nImage Runtime Version: " + assembly.ImageRuntimeVersion);
Console.WriteLine("\nUNC location: " + assembly.Location);
Console.WriteLine("\nGets module containing manifest for current assembly: " + assembly.ManifestModule);
Console.WriteLine("\nIf loaded into the reflection-only context: " + assembly.ReflectionOnly);
// // Is not compiled by ideone.com, possible coz it's using Mono
// Console.WriteLine("\nWas generated dynamically by reflection emit: " + assembly.IsDynamic);
// // Was generated dynamically by reflection emit: False
// Console.WriteLine("\nIs loaded with full trust: " + assembly.IsFullyTrusted);
// // Is loaded with full trust: True
// Console.WriteLine("\nGrant set of current assembly: " + assembly.PermissionSet);
// // Grant set of current assembly: <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" />
// Console.WriteLine("\nSet of security rules which was enforced by CLR: " + assembly.SecurityRuleSet);
// // Set of security rules which was enforced by CLR: Level2
foreach (var atr in assembly.GetCustomAttributes(true))
{
Console.WriteLine(atr.ToString());
}
// // System.Runtime.CompilerServices.RuntimeCompatibilityAttribute
}
}
public class SomeClass
{
string field;
public SomeClass()
{
field = "firld value";
}
public void Method()
{
if(String.IsNullOrEmpty(field))
{
Console.WriteLine("Field '" + field + "' is not null");
}
else
{
Console.WriteLine("Field is null");
}
}
}