本文整理汇总了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);
}
}
}
}
示例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);
}
示例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);
}
示例4: WfCirculateExecutor
public WfCirculateExecutor(IWfActivity operatorActivity,
IWfActivity targetActivity,
IEnumerable<IUser> circulators)
: base(operatorActivity, targetActivity, WfControlOperationType.Circulate)
{
circulators.NullCheck("circulators");
this.Circulators = circulators;
}
示例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;
}
示例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]);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
});
}
示例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();
}
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}