Assembly in C#
1. using System.Reflection.Assembly
System.Reflection.AssemblyName name = System.Reflection.Assembly.GetExecutingAssembly().GetName();
//name is {AssemblyNameInProperties, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null}
byte[] key = name.GetPublicKey();
2. reflection
Assembly assem = typeof(ExampleClass).Assembly;
// Create an object from the assembly, passing in the correct number // and type of arguments for the constructor. Object o = assem.CreateInstance("Example", false, BindingFlags.ExactBinding, null, new Object[] { 2 }, null, null); // Make a late-bound call to an instance method of the object. MethodInfo m = assem.GetType("Example").GetMethod("SampleMethod"); Object ret = m.Invoke(o, new Object[] { 42 }); Console.WriteLine("SampleMethod returned {0}.", ret);
reference:
docs.microsoft.com/en-us/dotnet/api/system.reflection.assembly?view=netframework-4.7.2
Formatting:
https://docs.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting?view=netframework-4.7.2
Console.WriteLine(Convert.ToString(omegaSymbol, 2).PadLeft(16,'0'));
评论
发表评论