当前位置: 首页>>代码示例>>C#>>正文


C# IList.IsNullOrEmpty方法代码示例

本文整理汇总了C#中IList.IsNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# IList.IsNullOrEmpty方法的具体用法?C# IList.IsNullOrEmpty怎么用?C# IList.IsNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IList的用法示例。


在下文中一共展示了IList.IsNullOrEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConditionResolver

        public ConditionResolver(IList<Condition> conditions)
        {
            if (conditions.IsNullOrEmpty())
                throw new ArgumentNullException(nameof(conditions));

            _conditions = conditions;
        }
开发者ID:craigshaw,项目名称:SoldOut,代码行数:7,代码来源:ConditionResolver.cs

示例2: SavePluginLog

		/// <summary>
		/// Serializes the list of active plugins to the permanent store.
		/// </summary>
		/// <returns>The ordered list of active plugins.</returns>
		public void SavePluginLog(IList<Plugin> p_lstActivePlugins)
		{
			if (p_lstActivePlugins.IsNullOrEmpty())
			{
				LoadOrderManager.SetActivePlugins(GameMode.OrderedCriticalPluginNames);
				return;
			}
			
			List<string> lstPlugins = new List<string>();
			foreach (Plugin plgPlugin in p_lstActivePlugins)
				lstPlugins.Add(plgPlugin.Filename);
			lstPlugins.Sort();

			List<string> lstActivePlugins = new List<string>();
			foreach (string strPlugin in GameMode.OrderedCriticalPluginNames)
			{
				lstPlugins.RemoveAll(x => x.Equals(strPlugin, StringComparison.CurrentCultureIgnoreCase));
				if (!lstActivePlugins.Contains(strPlugin, StringComparer.CurrentCultureIgnoreCase))
					lstActivePlugins.Add(strPlugin);
			}
			foreach (Plugin plgPlugin in PluginOrderLog.OrderedPlugins)
			{
				if (lstPlugins.Contains(plgPlugin.Filename, StringComparer.CurrentCultureIgnoreCase))
					if (!lstActivePlugins.Contains(plgPlugin.Filename, StringComparer.CurrentCultureIgnoreCase))
						lstActivePlugins.Add(plgPlugin.Filename);
			}
			LoadOrderManager.SetActivePlugins(lstActivePlugins.ToArray());
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:32,代码来源:GamebryoActivePluginLogSerializer.cs

示例3: GetVehicleStoreTableConfigList

        public List<EHistoryDataStoreConfig> GetVehicleStoreTableConfigList(IList<Guid> vehicleCodes)
        {
            if (vehicleCodes.IsNullOrEmpty())
                return null;

            List<EHistoryDataStoreConfig> res = null;
            string cmdText = string.Format("select RecordID, VehicleCode, StoreTable, ENABLE, CreateDate, remark from gps_historydatastoreconfig where VehicleCode in ('{0}')", vehicleCodes.JoinToString<Guid>("','"));
            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, cmdText))
            {
                if (sdr != null)
                {
                    res = new List<EHistoryDataStoreConfig>();
                    while (sdr.Read())
                    {
                        res.Add(new EHistoryDataStoreConfig
                        {
                            RecordID = sdr.GetGuid(0),
                            VehicleCode = sdr.GetGuid(1),
                            StoreTable = GetHisotryDataStoreTable(sdr.GetGuid(2)),
                            Enable = sdr.GetShort(3) == 1,
                            CreateDate = sdr.GetDateTimeExt(4),
                            Remark = sdr.GetStringExt(5)
                        });
                    }
                    sdr.Close();
                }
            }
            return res;
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:29,代码来源:GpsHistoryDataStoreConfigDAL.cs

示例4: Count

        /// <summary>
        /// 统计停车次数,过滤停车时长小于指定值的次数
        /// </summary>
        /// <param name="ltVehicleCode"></param>
        /// <param name="beginTime"></param>
        /// <param name="endTime"></param>
        /// <param name="second"></param>
        /// <param name="tenantCode"></param>
        /// <returns></returns>
        public Dictionary<Guid, VCountStopCar> Count(IList<Guid> ltVehicleCode, DateTime beginTime, DateTime endTime, int second, string tenantCode)
        {
            if (ltVehicleCode.IsNullOrEmpty())
                return new Dictionary<Guid, VCountStopCar>();

            Dictionary<Guid, TimeSpan> totalTimes; //运行轨迹的总时长
            IList<VStopCarReport> list = SearchStop(ltVehicleCode, beginTime, endTime, second, tenantCode, out totalTimes);
            
            Dictionary<Guid, VCountStopCar> dic = new Dictionary<Guid, VCountStopCar>();
            if (list != null && list.Count > 0)
            { //合并停车明细
                VCountStopCar vCount;
                foreach (var item in list)
                {
                    if (dic.ContainsKey(item.VehicleCode))
                    {
                        vCount = dic[item.VehicleCode];
                        vCount.Count++;
                        vCount.CountTime += item.StopTimeSpan;
                        //vCount.TotalTime += item.TotalTimeSpan;
                    }
                    else
                    {
                        vCount = new VCountStopCar();
                        vCount.Count++;
                        vCount.CountTime = item.StopTimeSpan;
                        //vCount.TotalTime = item.TotalTimeSpan;
                        vCount.VehicleCode = item.VehicleCode;
                        vCount.LicenceNumber = item.LicenceNumber;
                        dic.Add(vCount.VehicleCode, vCount);
                    }
                }
            }
            foreach (var item in totalTimes)
            {
                if (dic.ContainsKey(item.Key))
                {
                    dic[item.Key].TotalTime = item.Value;
                }
                else
                {
                    dic.Add(item.Key, new VCountStopCar
                    {
                        VehicleCode = item.Key,
                        Count = 0,
                        CountTime = new TimeSpan(0),
                        TotalTime = item.Value
                    });
                }
            }

            return dic;
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:62,代码来源:StopCarReportService.cs

示例5: Delete

        public void Delete(IList<Guid> vehicleCodes, Guid areaCode)
        {
            if (vehicleCodes.IsNullOrEmpty())
                return;
            using (IRepository repository = SessionManager.CreateRepository(typeof(ETraceAlertSetting)))
            {
                Query query = new Query(typeof(ETraceAlertSetting));
                Expression expression = null;
                ExpressionUtility<Guid>.AddExpression("VehicleCode", vehicleCodes, PolynaryOperatorType.In, ref expression);
                ExpressionUtility<Guid>.AddExpression("TracePoint.RecordID", areaCode, BinaryOperatorType.EqualTo, ref expression);

                query.Expression = expression;
                repository.DeleteBy(query);
            }
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:15,代码来源:TraceAlertSettingServ.cs

示例6: Build

        public Grid Build(IList<IPanelItem> items)
        {
            var grid = new Grid();

            var i = 1;

            while (!items.IsNullOrEmpty())
            {
                grid.Blocks.Add(GenerateBlock(items.Take(i)));

                items = items.Skip(i).ToList();

                if (items.IsNullOrEmpty())
                    break;

                i = i == 1 ? 4 : 1;

                grid.Blocks.Add(GenerateBlock(items.Take(i)));

                items = items.Skip(i).ToList();
            }

            return grid;
        }
开发者ID:niraltmark,项目名称:PicturesApp,代码行数:24,代码来源:GridBuilderService.cs

示例7: Expand

 private static IList<ParameterInstances> Expand(IList<ParameterInstances> instancesList, IList<ParameterDefinition> definitions)
 {
     if (definitions.IsNullOrEmpty())
         return instancesList;
     var nextDefinition = definitions.First();
     var newInstancesList = new List<ParameterInstances>();
     foreach (var instances in instancesList)
         foreach (var value in nextDefinition.Values)
         {
             var items = new List<ParameterInstance>();
             items.AddRange(instances.Items);
             items.Add(new ParameterInstance(nextDefinition, value));
             newInstancesList.Add(new ParameterInstances(items));
         }
     return Expand(newInstancesList, definitions.Skip(1).ToArray());
 }
开发者ID:omariom,项目名称:BenchmarkDotNet,代码行数:16,代码来源:ParameterDefinitions.cs

示例8: Search

        public IList<EBreakOilLastRecord> Search(IList<Guid> vehicleCodes)
        {
            if (vehicleCodes.IsNullOrEmpty())
            {
                return null;
            }
            using (IRepository repository = SessionManager.CreateRepository(typeof(EBreakOilLastRecord)))
            {
                Query query = new Query(typeof(EBreakOilLastRecord));
                Expression expression = Expression.CreateExpression("VehicleCode", PolynaryOperatorType.In, vehicleCodes);
                query.Expression = expression;
        
                var list = repository.List<EBreakOilLastRecord>(query);

                return list;
            }
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:17,代码来源:BreakOilLastRecordManager.cs

示例9: GetMultipleAsync

        public IAsyncOperation<IList<SynchronizedType>> GetMultipleAsync(IList<string> typeIDs)
        {
            if (typeIDs.IsNullOrEmpty())
            {
                throw new ArgumentException("typeIDs");
            }

            return AsyncInfo.Run<IList<SynchronizedType>>(async cancelToken =>
            {
                List<SynchronizedType> sTypes = new List<SynchronizedType>();
                foreach(string typeID in typeIDs)
                {
                    SynchronizedType type = await this.Ensure(typeID, cancelToken);
                    sTypes.Add(type);
                }

                return sTypes;
            });
        }
开发者ID:CHBase,项目名称:chbase-windows8-sdk,代码行数:19,代码来源:SynchronizedTypeManager.cs

示例10: Target

        static bool Target(IList<string> unparsed)
        {
            string url = command_url;
            if (false == unparsed.IsNullOrEmpty())
            {
                url = unparsed[0];
            }

            IVcapClient vc = new VcapClient();
            VcapClientResult rslt = vc.Target(url);
            if (rslt.Success)
            {
                Console.WriteLine(String.Format(Resources.Vmc_TargetDisplay_Fmt, rslt.Message));
            }
            else
            {
                Console.WriteLine(String.Format(Resources.Vmc_TargetNoSuccessDisplay_Fmt, rslt.Message));
            }

            return rslt.Success;
        }
开发者ID:hellojais,项目名称:ironfoundry,代码行数:21,代码来源:Target.cs

示例11: GetViewsAsync

        public IAsyncOperation<IList<SynchronizedView>> GetViewsAsync(IList<string> viewNames)
        {
            if (viewNames.IsNullOrEmpty())
            {
                throw new ArgumentException("viewNames");
            }

            return AsyncInfo.Run<IList<SynchronizedView>>(async cancelToken => 
            {
                LazyList<SynchronizedView> views = new LazyList<SynchronizedView>();
                foreach(string viewName in viewNames)
                {
                    SynchronizedView view = await this.GetViewAsync(viewName, cancelToken);
                    if (view != null)
                    {
                        views.Add(view);
                    }
                }

                return views.HasValue ? views.Value : null;
            });
        }
开发者ID:CHBase,项目名称:chbase-windows8-sdk,代码行数:22,代码来源:LocalRecordStore.cs

示例12: SaveLocalItems

        public async Task SaveLocalItems(IList<ReaderItem> items)
        {
            await WriteItemsToDisk(items, SourceProvider.Local);

            if (!items.IsNullOrEmpty())
            {
                CacheCount.LocalCount = items.Count;
            }
            else
            {
                CacheCount.LocalCount = null;
            }

            WriteCountsToStorage().ConfigureAwait(false);
        }
开发者ID:ScottIsAFool,项目名称:Speader,代码行数:15,代码来源:CacheService.cs

示例13: GetChangesForItemsAsync

        public IAsyncOperation<IList<RecordItemChange>> GetChangesForItemsAsync(IList<string> itemIDs)
        {
            if (itemIDs.IsNullOrEmpty())
            {
                throw new ArgumentException("itemID");
            }

            return AsyncInfo.Run<IList<RecordItemChange>>(async cancelToken =>
            {
                using (await CrossThreadLockScope.Enter(m_lock))
                {
                    List<RecordItemChange> changes = new List<RecordItemChange>();
                    foreach(string id in itemIDs)
                    {
                        RecordItemChange change = await this.GetChangeAsync(id);
                        if (change != null)
                        {
                            changes.Add(change);
                        }
                    }
                    return changes;
                }
            });
        }
开发者ID:shashidharpalli,项目名称:Enabling-Programmable-Self-with-HealthVault,代码行数:24,代码来源:RecordItemChangeTable.cs

示例14: GetCurrentInfoList

        public IList<EGPSCurrentInfo> GetCurrentInfoList(IList<Guid> ltVehicleCode)
        {   
            //Query query = new Query(typeof(EGPSCurrentInfo));
            //query.Expression = Expression.CreateExpression("VehicleCode", PolynaryOperatorType.In, ltVehicleCode);
            //using (IRepository repository = SessionManager.CreateRepository(typeof(EGPSCurrentInfo)))
            //{
            //    return repository.List<EGPSCurrentInfo>(query);
            //}

            //优化
            if (ltVehicleCode.IsNullOrEmpty())
                return null;

            List<EGPSCurrentInfo> list = null;
            string sqlText = string.Format(@"SELECT ID,GPSCode,Longitude,Latitude,Speed,Direction,ReportTime,OilState,ACCState,Mileage,PowerState,
StarkMileage,AntennaState,OilBearing,DoorStatus,PhotoPath,VehicleCode,PlunderState,Detector1,Detector2,Detector3,Detector4,CoolerStatus
 FROM gps_currentinfo WHERE VehicleCode in ('{0}')", ltVehicleCode.JoinToString<Guid>("','"));

            using (MySqlDataReader sdr = MySqlDB.GetDataReader(CommandType.Text, sqlText))
            {
                if (sdr != null)
                {
                    list = new List<EGPSCurrentInfo>();
                    while (sdr.Read())
                    {
                        list.Add(new EGPSCurrentInfo
                        {
                            ID = sdr.GetGuid(0),
                            GPSCode = sdr.GetString(1),
                            Longitude = sdr.GetDouble(2),
                            Latitude = sdr.GetDouble(3),
                            Speed = sdr.GetDouble(4),
                            Direction = sdr.GetDouble(5),
                            ReportTime = sdr.GetDateTime(6),
                            OilState = sdr.GetInt(7),
                            ACCState = sdr.GetInt(8),
                            Mileage = sdr.GetDouble(9),
                            PowerState = sdr.GetInt(10),
                            StarkMileage = sdr.GetDouble(11),
                            AntennaState = sdr.GetInt(12),
                            OilBearing = sdr.GetDoubleExt(13),
                            DoorStatus = sdr.GetInt(14),
                            PhotoPath = sdr.GetStringExt(15),
                            VehicleCode = sdr.GetGuidExt(16),
                            PlunderState = sdr.GetInt16(17),
                            Detector1 = sdr.GetFloatNull(18),
                            Detector2 = sdr.GetFloatNull(19),
                            Detector3 = sdr.GetFloatNull(20),
                            Detector4 = sdr.GetFloatNull(21),
                            CoolerStatus = sdr.GetInt(22)
                        });
                    }
                    sdr.Close();
                }
            }

            return list;
        }
开发者ID:hhahh2011,项目名称:CH.Gps,代码行数:58,代码来源:PositionService.cs

示例15: SynchronizeTypesAsync

        /// <summary>
        /// Synchronize multiple types with a single roundtrip
        /// </summary>
        /// <param name="typeIDs">TypeIds to sync</param>
        /// <param name="maxAgeInSeconds">View age</param>
        /// <returns>A list of type ids actually synchronized</returns>
        public IAsyncOperation<IList<string>> SynchronizeTypesAsync(IList<string> typeIDs, int maxAgeInSeconds)
        {
            if (typeIDs.IsNullOrEmpty())
            {
                throw new ArgumentException("typeIDs");
            }
            if (maxAgeInSeconds < 0)
            {
                throw new ArgumentException("maxAgeInSeconds");
            }

            return AsyncInfo.Run<IList<string>>(async cancelToken =>
            {
                IList<SynchronizedType> sTypes = await this.GetMultipleAsync(typeIDs);
                SynchronizedViewSynchronizer synchronizer = new SynchronizedViewSynchronizer(m_recordStore.Record, maxAgeInSeconds);
                synchronizer.MaxAgeInSeconds = maxAgeInSeconds;

                IList<ISynchronizedView> synchronized = await synchronizer.SynchronizeAsync(sTypes.Cast<ISynchronizedView>().ToList());
                if (synchronized.IsNullOrEmpty())
                {
                    return null;
                }
                
                string[] syncedIDs = (from view in synchronized
                        select ((SynchronizedType) view).TypeID).ToArray();

                return syncedIDs;
            });
        }
开发者ID:CHBase,项目名称:chbase-windows8-sdk,代码行数:35,代码来源:SynchronizedTypeManager.cs


注:本文中的IList.IsNullOrEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。