示例#1
0
        public ReadOnlyCollection <TResult> QueryAll <TResult>(
            WmiQueryBase wmiQuery,
            ManagementObjectSearcher searcher = null)
            where TResult : class, new()
        {
            ManagementObjectCollection source = this.QueryAll(wmiQuery.SelectQuery, searcher);

            return(new ReadOnlyCollection <TResult>(source != null ? (IList <TResult>)source.Cast <ManagementBaseObject>().Select <ManagementBaseObject, TResult>(new Func <ManagementBaseObject, TResult>(WmiService.Extract <TResult>)).ToList <TResult>() : (IList <TResult>)null));
        }
示例#2
0
        public TResult QueryFirst <TResult>(WmiQueryBase wmiQuery) where TResult : class, new()
        {
            ManagementBaseObject managementBaseObject = QueryFirst(wmiQuery.SelectQuery);

            if (managementBaseObject != null)
            {
                return(Extract <TResult>(managementBaseObject));
            }
            return(null);
        }
示例#3
0
        // Token: 0x06000111 RID: 273 RVA: 0x0000436C File Offset: 0x0000256C
        public TResult QueryFirst <TResult>(WmiQueryBase wmiQuery) where TResult : class, new()
        {
            ManagementBaseObject managementBaseObject = this.QueryFirst(wmiQuery.SelectQuery, null);

            if (managementBaseObject != null)
            {
                return(WmiService.Extract <TResult>(managementBaseObject));
            }
            return(default(TResult));
        }
示例#4
0
 public ReadOnlyCollection <TResult> QueryAll <TResult>(WmiQueryBase wmiQuery, ManagementObjectSearcher searcher = null) where TResult : class, new()
 {
     return(new ReadOnlyCollection <TResult>(QueryAll(wmiQuery.SelectQuery, searcher)?.Cast <ManagementBaseObject>().Select(Extract <TResult>).ToList()));
 }