using System; using System.Diagnostics; using System.IO; using System.Reflection; namespace BlueWest.Tools { public static class AssemblyUtils { public static double GetProcessMemory() { var memory = 0.0; using (Process proc = Process.GetCurrentProcess()) { // The proc.PrivateMemorySize64 will returns the private memory usage in byte. // Would like to Convert it to Megabyte? divide it by 2^20 memory = proc.PrivateMemorySize64 / (1024*1024); } return memory; } public static string GetAssemblyPath() { var assemblyName = GetAssemblyLocation(); var directory = Path.GetDirectoryName(assemblyName); return directory; } private static string GetAssemblyLocation() { var assembly = Assembly.GetEntryAssembly(); var assemblyName = assembly.Location; return assemblyName; } } }