private static T GetProperty <T>(ManagedObjectReference from, string propName) where T : class { var result = vim.RetrievePropertiesEx(serviceContent.propertyCollector, GetSinglePropSpec(from, propName), new RetrieveOptions() { }); if (result is null) { Error(new Exception("RetrievePropertiesEx failed")); } return(result.objects[0].propSet[0].val as T); }