本文整理汇总了C#中IList.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# IList.IsEmpty方法的具体用法?C# IList.IsEmpty怎么用?C# IList.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IList
的用法示例。
在下文中一共展示了IList.IsEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteEntities
/// <summary>
/// Elimina entidades (usuarios o grupos) a la regla con el id especificado
/// </summary>
/// <param name="rule"></param>
/// <param name="entities"></param>
public static IObservable<Rule> DeleteEntities(Rule rule, IList<IEntity> entities)
{
if (rule.Id == null) throw new InvalidDataException("The provided rule must have an Id");
if (entities == null || entities.IsEmpty())
return Observable.Defer(() => Observable.Return(rule));
return RestEndpointFactory
.Create<IRulesEndpoint>(SessionManager.Instance.CurrentLoggedUser)
.DeleteEntities(rule.Id, entities.IsEmpty()
? "0"
: entities.ToString(e => e.Id)).ToObservable()
.SubscribeOn(ThreadPoolScheduler.Instance)
.InterpretingErrors();
}
示例2: InitializeTiles
/// <summary>
/// Dient eenmalig uitgevoerd te worden
/// </summary>
private void InitializeTiles(ISessionFactory factory)
{
Random random = new Random();
int result = 0;
var nhSession = factory.OpenSession();
MapTiles = nhSession.QueryOver<MapTile>().List();
if (MapTiles.IsEmpty())
{
MapTiles = new List<MapTile>();
using (var transaction = nhSession.BeginTransaction())
{
for (int x = 0; x < 8; x++)
{
for (int y = 0; y < 8; y++)
{
result = random.Next(0, 10);
var tile = new MapTile() {Name = "Wasteland", X = x, Y = y};
MapTiles.Add(tile);
nhSession.Save(tile);
}
}
transaction.Commit();
}
}
}
示例3: IndexHint
public IndexHint(IndexHintAction hintAction,
IndexHintType hintType,
IndexHintScope hintScope,
IList<string> indexList)
{
if (hintAction == IndexHintAction.None)
{
throw new ArgumentException("index hint hintAction is null");
}
if (hintType == IndexHintType.None)
{
throw new ArgumentException("index hint hintType is null");
}
if (hintScope == IndexHintScope.None)
{
throw new ArgumentException("index hint hintScope is null");
}
HintAction = hintAction;
IndexType = hintType;
HintScope = hintScope;
if (indexList == null || indexList.IsEmpty())
{
IndexList = new List<string>(0);
}
else if (indexList is List<string>)
{
IndexList = indexList;
}
else
{
IndexList = new List<string>(indexList);
}
}
示例4: SignatureHelpItems
public SignatureHelpItems(
IList<SignatureHelpItem> items,
TextSpan applicableSpan,
int argumentIndex,
int argumentCount,
string argumentName,
int? selectedItem = null)
{
Contract.ThrowIfNull(items);
Contract.ThrowIfTrue(items.IsEmpty());
Contract.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value > items.Count);
if (argumentIndex < 0)
{
throw new ArgumentException($"{nameof(argumentIndex)} < 0", nameof(argumentIndex));
}
if (argumentCount < argumentIndex)
{
throw new ArgumentException($"{nameof(argumentCount)} < {nameof(argumentIndex)}", nameof(argumentIndex));
}
this.Items = items;
this.ApplicableSpan = applicableSpan;
this.ArgumentIndex = argumentIndex;
this.ArgumentCount = argumentCount;
this.SelectedItemIndex = selectedItem;
this.ArgumentName = argumentName;
}
示例5: GroupConcat
public GroupConcat(bool distinct,
IList<IExpression> exprList,
IExpression orderBy,
bool isDesc,
IList<IExpression> appendedColumnNames,
string separator)
: base("GROUP_CONCAT", exprList)
{
IsDistinct = distinct;
OrderBy = orderBy;
IsDesc = isDesc;
if (appendedColumnNames == null || appendedColumnNames.IsEmpty())
{
AppendedColumnNames = new List<IExpression>(0);
}
else if (appendedColumnNames is List<IExpression>)
{
AppendedColumnNames = appendedColumnNames;
}
else
{
AppendedColumnNames = new List<IExpression>(
appendedColumnNames);
}
Separator = separator ?? ",";
}
示例6: TableReferences
/// <exception cref="System.SqlSyntaxErrorException" />
public TableReferences(IList<TableReference> list)
{
if (list == null || list.IsEmpty())
{
throw new SqlSyntaxErrorException("at least one table reference");
}
_list = EnsureListType(list);
}
示例7: CommentColumns
public ActionResult CommentColumns(string id, IList<Column> columns)
{
if (!columns.IsEmpty())
{
foreach (var item in columns)
{
this.DynamicQuery.Provider.DbMetadata.CommentColumn(id, item.Name, item.Description);
}
}
return CloseDialogWithAlert("修改成功!");
}
示例8: IndexDefinition
public IndexDefinition(IndexType indexType,
IList<IndexColumnName> columns,
IList<IndexOption> options)
{
IndexType = indexType;
if (columns == null || columns.IsEmpty())
{
throw new ArgumentException("columns is null or empty");
}
Columns = columns;
Options = options == null || options.IsEmpty() ? new List<IndexOption>(0) : options;
}
示例9: TableRuleConfig
public TableRuleConfig(string name, IList<RuleConfig> rules)
{
if (name == null)
{
throw new ArgumentException("name is null");
}
this.name = name;
if (rules == null || rules.IsEmpty())
{
throw new ArgumentException("no rule is found");
}
this.rules = new List<RuleConfig>(rules).AsReadOnly();
}
示例10: DalSetStatement
public DalSetStatement(IList<Pair<VariableExpression, IExpression>> assignmentList)
{
if (assignmentList == null || assignmentList.IsEmpty())
{
AssignmentList = new List<Pair<VariableExpression, IExpression>>(0);
}
else if (assignmentList is List<Pair<VariableExpression, IExpression>>)
{
AssignmentList = assignmentList;
}
else
{
AssignmentList = new List<Pair<VariableExpression, IExpression>>(assignmentList);
}
}
示例11: FunctionExpression
public FunctionExpression(string functionName, IList<IExpression> arguments)
{
this.functionName = functionName;
if (arguments == null || arguments.IsEmpty())
{
this.arguments = new List<IExpression>(0);
}
else if (arguments is List<IExpression>)
{
this.arguments = arguments;
}
else
{
this.arguments = new List<IExpression>(arguments);
}
}
示例12: SignatureHelpItems
public SignatureHelpItems(
IList<SignatureHelpItem> items,
TextSpan applicableSpan,
int argumentIndex,
int argumentCount,
string argumentName,
int? selectedItem = null)
{
Contract.ThrowIfNull(items);
Contract.ThrowIfTrue(items.IsEmpty());
Contract.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count);
if (argumentIndex < 0)
{
throw new ArgumentException($"{nameof(argumentIndex)} < 0. {argumentIndex} < 0", nameof(argumentIndex));
}
if (argumentCount < argumentIndex)
{
throw new ArgumentException($"{nameof(argumentCount)} < {nameof(argumentIndex)}. {argumentCount} < {argumentIndex}", nameof(argumentIndex));
}
// Adjust the `selectedItem` index if duplicates are able to be removed.
var distinctItems = items.Distinct().ToList();
if (selectedItem.HasValue && items.Count != distinctItems.Count)
{
// `selectedItem` index has already been determined to be valid, it now needs to be adjusted to point
// to the equivalent item in the reduced list to account for duplicates being removed
// E.g.,
// items = {A, A, B, B, C, D}
// selectedItem = 4 (index for item C)
// ergo
// distinctItems = {A, B, C, D}
// actualItem = C
// selectedItem = 2 (index for item C)
var actualItem = items[selectedItem.Value];
selectedItem = distinctItems.IndexOf(actualItem);
Debug.Assert(selectedItem.Value >= 0, "actual item was not part of the final list");
}
this.Items = distinctItems;
this.ApplicableSpan = applicableSpan;
this.ArgumentIndex = argumentIndex;
this.ArgumentCount = argumentCount;
this.SelectedItemIndex = selectedItem;
this.ArgumentName = argumentName;
}
示例13: DdlDropTableStatement
public DdlDropTableStatement(IList<Identifier> tableNames,
bool temp,
bool ifExists,
DropTableMode dropTableMode)
{
if (tableNames == null || tableNames.IsEmpty())
{
TableNames = new List<Identifier>(0);
}
else
{
TableNames = tableNames;
}
IsTemp = temp;
IsIfExists = ifExists;
Mode = dropTableMode;
}
示例14: TableRefFactor
public TableRefFactor(Identifier table, string alias, IList<IndexHint> hintList)
: base(alias)
{
this.table = table;
if (hintList == null || hintList.IsEmpty())
{
HintList = new List<IndexHint>(0);
}
else if (hintList is List<IndexHint>)
{
HintList = hintList;
}
else
{
HintList = new List<IndexHint>(hintList);
}
}
示例15: ShowProfile
public ShowProfile(IList<ProfileType> types, IExpression forQuery, Limit limit)
{
if (types == null || types.IsEmpty())
{
ProfileTypes = new List<ProfileType>(0);
}
else if (types is List<ProfileType>)
{
ProfileTypes = types;
}
else
{
ProfileTypes = new List<ProfileType>(types);
}
ForQuery = forQuery;
Limit = limit;
}