public static IEnumerable <IVdsVolume> GetVolumes(this IVdsService vdsService) { foreach (var pack in vdsService.GetPacks()) { IEnumVdsObject volumeEnum; pack.QueryVolumes(out volumeEnum); object iface; int fetched; while (0 == volumeEnum.Next(1, out iface, out fetched)) { yield return(iface as IVdsVolume); } } }
public static IEnumerable <IVdsDisk> GetDisks(this IVdsService vdsService) { foreach (var pack in vdsService.GetPacks()) { IEnumVdsObject diskEnum; Marshal.ThrowExceptionForHR(pack.QueryDisks(out diskEnum)); object iface; int fetched; while (0 == diskEnum.Next(1, out iface, out fetched)) { yield return(iface as IVdsDisk); } } }