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


C# IEnumerable.NullCheck方法代码示例

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


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

示例1: MergeActivityMatrix

        /// <summary>
        /// 将活动矩阵与审批矩阵进行合并,以第一个矩阵的列定义为准
        /// </summary>
        /// <param name="amRows"></param>
        /// <param name="amDefinitions"></param>
        /// <param name="apRows"></param>
        /// <param name="apDefinitions"></param>
        public static void MergeActivityMatrix(this SOARolePropertyRowCollection amRows, SOARolePropertyDefinitionCollection amDefinitions, IEnumerable<SOARolePropertyRow> apRows, SOARolePropertyDefinitionCollection apDefinitions)
        {
            amDefinitions.NullCheck("amDefinitions");
            amRows.NullCheck("amRows");
            apDefinitions.NullCheck("apDefinitions");
            apRows.NullCheck("apRows");

            int maxRowNumber = GetMaxRowNumber(amRows);

            foreach (SOARolePropertyRow apRow in apRows)
            {
                SOARolePropertyRow newRow = new SOARolePropertyRow(amRows.Role);

                newRow.RowNumber = ++maxRowNumber;
                newRow.OperatorType = apRow.OperatorType;
                newRow.Operator = apRow.Operator;

                foreach (SOARolePropertyValue srv in apRow.Values)
                {
                    if (amDefinitions.ContainsKey(srv.Column.Name))
                    {
                        SOARolePropertyValue newValue = new SOARolePropertyValue(amDefinitions[srv.Column.Name]);

                        newValue.Value = srv.Value;

                        newRow.Values.Add(newValue);
                    }
                }
            }
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:37,代码来源:WfMatrixExtensions.cs

示例2: ServerToClient

        public void ServerToClient(IEnumerable<KeyValuePair<string, object>> server, IDictionary<string, object> client)
        {
            client.NullCheck("client");
            server.NullCheck("server");

            foreach (KeyValuePair<string, object> kp in server)
                client[kp.Key] = ServerObjectToClient(kp.Value);
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:8,代码来源:WfClientDictionaryConverter.cs

示例3: ClientToServer

        public void ClientToServer(IEnumerable<KeyValuePair<string, object>> client, IDictionary<string, object> server)
        {
            client.NullCheck("client");
            server.NullCheck("server");

            foreach (KeyValuePair<string, object> kp in client)
                server[kp.Key] = ClientObjectToServer(kp.Value);
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:8,代码来源:WfClientDictionaryConverter.cs

示例4: WfCirculateExecutor

        public WfCirculateExecutor(IWfActivity operatorActivity,
                                IWfActivity targetActivity,
                                IEnumerable<IUser> circulators)
            : base(operatorActivity, targetActivity, WfControlOperationType.Circulate)
        {
            circulators.NullCheck("circulators");

            this.Circulators = circulators;
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:9,代码来源:WfCirculateExecutor.cs

示例5: AMSChannelInEventExecutorBase

        public AMSChannelInEventExecutorBase(string eventID, IEnumerable<string> channelIDs, AMSOperationType operationType)
            : base(operationType)
        {
            eventID.CheckStringIsNullOrEmpty("eventID");
            channelIDs.NullCheck("channelIDs");

            this.EventID = eventID;
            this.ChannelIDs = channelIDs;
        }
开发者ID:zhshen,项目名称:HuaweiAMS,代码行数:9,代码来源:AMSChannelInEventExecutorBase.cs

示例6: ClientToServer

        /// <summary>
        /// 仅复制目标集合中已有的属性
        /// </summary>
        /// <param name="cpvc"></param>
        /// <param name="pvc"></param>
        public void ClientToServer(IEnumerable<ClientPropertyValue> cpvc, PropertyValueCollection pvc)
        {
            cpvc.NullCheck("cpvc");
            pvc.NullCheck("pvc");

            foreach (ClientPropertyValue cpv in cpvc)
            {
                if (pvc.ContainsKey(cpv.Key))
                    ClientPropertyValueConverter.Instance.ClientToServer(cpv, pvc[cpv.Key]);
            }
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:16,代码来源:ClientPropertyValueConverter.cs

示例7: ClientToServer

        public void ClientToServer(IEnumerable<WfClientBranchProcessStartupParams> client, ICollection<WfBranchProcessStartupParams> server)
        {
            client.NullCheck("client");

            foreach (WfClientBranchProcessStartupParams ct in client)
            {
                WfBranchProcessStartupParams st = null;

                WfClientBranchProcessStartupParamsConverter.Instance.ClientToServer(ct, ref st);

                server.Add(st);
            }
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:13,代码来源:WfClientBranchProcessStartupParamsConverter.cs

示例8: ServerToClient

        /// <summary>
        /// 如果目标集合中不存在,则添加一项
        /// </summary>
        /// <param name="pvc"></param>
        /// <param name="cpvc"></param>
        public void ServerToClient(IEnumerable<PropertyValue> pvc, ClientPropertyValueCollection cpvc)
        {
            pvc.NullCheck("pvc");
            cpvc.NullCheck("cpvc");

            foreach (PropertyValue pv in pvc)
            {
                ClientPropertyValue cpv = cpvc[pv.Definition.Name];

                if (cpv == null)
                {
                    cpv = new ClientPropertyValue(pv.Definition.Name);
                    cpvc.Add(cpv);
                }
                ClientPropertyValueConverter.Instance.ServerToClient(pv, cpv);
            }
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:22,代码来源:ClientPropertyValueConverter.cs

示例9: ServerToClient

        public WfClientUserOperationLogCollection ServerToClient(IEnumerable<UserOperationLog> server)
        {
            server.NullCheck("server");

            WfClientUserOperationLogCollection client = new WfClientUserOperationLogCollection();

            foreach (UserOperationLog serverItem in server)
            {
                WfClientUserOperationLog clientItem = null;

                this.ServerToClient(serverItem, ref clientItem);

                client.Add(clientItem);
            }

            return client;
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:17,代码来源:WfClientUserOperationLogConverter.cs

示例10: Play

        public async void Play(IEnumerable<NGram<Chord>> enumerable)
        {
            Task.Factory.StartNew(() =>
                {
                    enumerable.NullCheck();

                    this.Playing = true;

                    var many = enumerable.SelectMany(x => x);
                    var count = many.Count(item => item.MidiChunk.Count);

                    foreach (var item in many)
                    {
                        foreach (var note in item.MidiChunk.Where(x => x.MidiMessage is ChannelMessage))
                        {
                            if (!Playing)
                            {
                                return;
                            }
                            var message = note.MidiMessage as ChannelMessage;
                            this.outDevice.Send(message);
                            if (note.DeltaTicks != 0)
                            {

                                float kSecondsPerTick = note.DeltaTicks / (OutputConstants.TicksPerQuarter * 1000000.0f);
                                float deltaTimeInMilliSeconds = note.DeltaTicks * kSecondsPerTick * 10000;
                                if (deltaTimeInMilliSeconds < 2000)
                                {
                                    this.wait = (int)deltaTimeInMilliSeconds;
                                    Thread.Sleep(this.wait);
                                }
                                else
                                {
                                    this.wait = OutputConstants.GotoSleepTImeInMilliseconds;
                                    Thread.Sleep(OutputConstants.GotoSleepTImeInMilliseconds);
                                }
                            }
                            else if (null != message && message.Command == ChannelCommand.NoteOn)
                            {
                                Thread.Sleep(OutputConstants.GotoSleepTImeInMilliseconds);
                            }
                        }
                    }
                });
        }
开发者ID:johndpope,项目名称:Improvisation,代码行数:45,代码来源:AsyncOutputPlayer.cs

示例11: Update

		public void Update(string ownerID, IEnumerable<SchemaObjectBase> users)
		{
			ownerID.CheckStringIsNullOrEmpty("ownerID");
			users.NullCheck("users");

			using (DbContext context = DbContext.GetContext(this.GetConnectionName()))
			{
				DbHelper.RunSqlWithTransaction(GetDeleteConditionCalculateResultSql(ownerID), this.GetConnectionName());

				StringBuilder strB = new StringBuilder();

				foreach (SchemaObjectBase user in users)
					DbHelper.RunSql(GetInsertConditionCalculateResultSql(ownerID, user.ID), this.GetConnectionName());

				ProcessProgress.Current.Increment();
				ProcessProgress.Current.Response();
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:18,代码来源:ConditionCalculateResultAdapter.cs

示例12: UpdateBatch

		/// <summary>
		/// 批量更新
		/// </summary>
		/// <param name="ownerID"></param>
		/// <param name="users"></param>
		public void UpdateBatch(string ownerID, IEnumerable<SchemaObjectBase> users)
		{
			ownerID.CheckStringIsNullOrEmpty("ownerID");
			users.NullCheck("users");

			StringBuilder strB = new StringBuilder();

			strB.Append(GetDeleteConditionCalculateResultSql(ownerID));

			foreach (SchemaObjectBase user in users)
			{
				strB.Append(TSqlBuilder.Instance.DBStatementSeperator);

				strB.Append(GetInsertConditionCalculateResultSql(ownerID, user.ID));
			}

			DbHelper.RunSqlWithTransaction(strB.ToString(), this.GetConnectionName());
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:23,代码来源:ConditionCalculateResultAdapter.cs

示例13: WfConsignExecutor

		public WfConsignExecutor(IWfActivity operatorActivity,
								IWfActivity targetActivity,
								WfAssigneeCollection assignees,
								IEnumerable<IUser> consignUsers,
								IEnumerable<IUser> circulateUsers,
								WfBranchProcessBlockingType blockingType,
								WfBranchProcessExecuteSequence sequence)
			: base(operatorActivity, targetActivity, WfControlOperationType.Consign)
		{
			assignees.NullCheck("assignees");
			consignUsers.NullCheck("users");

			(consignUsers.Count() > 0).FalseThrow<WfRuntimeException>("参与会签的用户数必须大于零");

			this.Assignees.CopyFrom(assignees);
			this.ConsignUsers = consignUsers;
			this.CirculateUsers = circulateUsers;
			this.BlockingType = blockingType;
			this.Sequence = sequence;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:20,代码来源:WfConsignExecutor.cs

示例14: GetParamsMatchedLevel

		/// <summary>
		/// 得到参数名称和方法参数的匹配度
		/// </summary>
		/// <param name="mi"></param>
		/// <param name="parameterNames"></param>
		/// <returns></returns>
		public static int GetParamsMatchedLevel(this MethodBase mi, IEnumerable<string> parameterNames)
		{
			mi.NullCheck("mi");
			parameterNames.NullCheck("parameterNames");

			int result = 0;

			List<string> parameterNameListInMethod = new List<string>();

			CollectMethodParameterNames(mi, parameterNameListInMethod);

			foreach (string pNameInMethod in parameterNameListInMethod)
			{
				if (parameterNames.Any(pn => string.Compare(pn, pNameInMethod, true) == 0))
					result++;
			}

			result -= Math.Abs(parameterNameListInMethod.Count - result);	//方法参数的个数减去匹配程度,形成新的匹配度

			return result;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:MethodExtensions.cs

示例15: CreateDefaultConsignTemplate

		/// <summary>
		/// 构造缺省的会签模板
		/// </summary>
		/// <param name="key"></param>
		/// <param name="blockingType"></param>
		/// <returns></returns>
		public static IWfBranchProcessTemplateDescriptor CreateDefaultConsignTemplate(
			string key, 
			WfBranchProcessExecuteSequence execSequence,
			WfBranchProcessBlockingType blockingType,
			IEnumerable<IUser> users)
		{
			key.CheckStringIsNullOrEmpty("key");
			users.NullCheck("users");

			WfBranchProcessTemplateDescriptor template = new WfBranchProcessTemplateDescriptor(key);

			template.BranchProcessKey = WfProcessDescriptorManager.DefaultConsignProcessKey;
			template.ExecuteSequence = execSequence;
			template.BlockingType = blockingType;

			users = users.Distinct(new OguObjectIDEqualityComparer<IUser>());

			foreach (IUser user in users)
				template.Resources.Add(new WfUserResourceDescriptor(user));
			
			return template;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:28,代码来源:WfTemplateBuilder.cs


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