private MemoryDetail GetSystemMemory() { #if !NETSTANDARD1_6 && !NET35 var winQuery = new ObjectQuery(WinObjQuery); var searcher = new ManagementObjectSearcher(winQuery); foreach (ManagementObject item in searcher.Get()) { var totalVisibleMemorySize = Convert.ToUInt64(item[TotalVisibleMemorySize]); var totalVirtualMemorySize = Convert.ToUInt64(item[TotalVirtualMemorySize]); var freePhysicalMemory = Convert.ToUInt64(item[FreePhysicalMemory]); var freeVirtualMemory = Convert.ToUInt64(item[FreeVirtualMemory]); var result = new MemoryDetail() { TotalVisibleMemorySize = totalVisibleMemorySize, TotalVirtualMemorySize = totalVirtualMemorySize, FreePhysicalMemory = freePhysicalMemory, FreeVirtualMemory = freeVirtualMemory }; return(result); } #endif //TODO -- NETSTANDARD1_6 impl return(new MemoryDetail()); }
private MemoryDetail GetSystemMemory() { var winQuery = new ObjectQuery(WinObjQuery); var searcher = new ManagementObjectSearcher(winQuery); foreach (ManagementObject item in searcher.Get()) { var totalVisibleMemorySize = Convert.ToUInt64(item[TotalVisibleMemorySize]); var totalVirtualMemorySize = Convert.ToUInt64(item[TotalVirtualMemorySize]); var freePhysicalMemory = Convert.ToUInt64(item[FreePhysicalMemory]); var freeVirtualMemory = Convert.ToUInt64(item[FreeVirtualMemory]); var result = new MemoryDetail() { TotalVisibleMemorySize = totalVisibleMemorySize, TotalVirtualMemorySize = totalVirtualMemorySize, FreePhysicalMemory = freePhysicalMemory, FreeVirtualMemory = freeVirtualMemory }; return result; } return new MemoryDetail(); }