0

I know it's hard to reproduce this problem, but maybe I'm doing some silly mistake here

but how can I improve performance of this call?

I already use cache for it, but maybe there's some smarter way because atm it take 2min on my machine and around 30sec on server and in both cases it's way too long in my opinion

public (bool Success, string Version) GetSomeVersion()
{
    //return(true, "1.6.2");
    var data = new ManagementObjectSearcher("SELECT * FROM Win32_Product WHERE Vendor = 'ABC' AND Name LIKE 'ABC%'").Get();

    ManagementBaseObject found = null;

    foreach (var item in data)
    {
        found = item;
        break;
    }

    if (found == null)
    {
        return (false, "");
    }

    return (true, found.GetPropertyValue("Version").ToString());
}
Joelty
  • 1,751
  • 5
  • 22
  • 64

0 Answers0