本文整理汇总了C#中IEnumerable.ToReadOnlyList方法的典型用法代码示例。如果您正苦于以下问题:C# IEnumerable.ToReadOnlyList方法的具体用法?C# IEnumerable.ToReadOnlyList怎么用?C# IEnumerable.ToReadOnlyList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnumerable
的用法示例。
在下文中一共展示了IEnumerable.ToReadOnlyList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlogSettingsHelper
public BlogSettingsHelper(IEnumerable<BlogSetting> blogSettings)
{
if (blogSettings == null)
{
throw new ArgumentNullException(nameof(blogSettings));
}
this.blogSettings = blogSettings.ToReadOnlyList();
this.BlogKeys =
this.blogSettings.Select(x => new BlogKey(x.BlogKey)).Where(x => x.HasValue).ToReadOnlyList();
}
示例2: SqlSelectExpression
public SqlSelectExpression(Type type, string alias, IEnumerable<SqlColumnDeclaration> columns, Expression from, Expression where, IEnumerable<Expression> orderBy, bool forUpdate)
: this(type, alias, columns.ToReadOnlyList(), from, where, orderBy.ToReadOnlyList(), null, false, null, null, forUpdate)
{
}
示例3: ChangeColumns
public SqlSelectExpression ChangeColumns(IEnumerable<SqlColumnDeclaration> columns, bool columnsAlreadyOrdered)
{
return new SqlSelectExpression(this.Type, this.Alias, columnsAlreadyOrdered ? columns.ToReadOnlyList() : columns.OrderBy(c => c.Name).ToReadOnlyList(), this.From, this.Where, this.OrderBy, this.GroupBy, this.Distinct, this.Take, this.Skip, this.ForUpdate);
}
示例4: SqlCreateIndexExpression
public SqlCreateIndexExpression(string indexName, SqlTableExpression table, bool unique, bool lowercaseIndex, IndexType indexType, bool ifNotExist, IEnumerable<SqlIndexedColumnExpression> columns)
: this(indexName, table, unique, lowercaseIndex, indexType, ifNotExist, columns.ToReadOnlyList())
{
}
示例5: SqlReferencesColumnExpression
public SqlReferencesColumnExpression(SqlTableExpression referencedTable, SqlColumnReferenceDeferrability deferrability, IEnumerable<string> referencedColumnNames, SqlColumnReferenceAction onDelete, SqlColumnReferenceAction onUpdate)
: this(referencedTable, deferrability, referencedColumnNames.ToReadOnlyList(), onDelete, onUpdate)
{
}
示例6: SqlCreateTableExpression
public SqlCreateTableExpression(SqlTableExpression table, bool ifNotExist, IEnumerable<SqlColumnDefinitionExpression> columnExpressions, IEnumerable<Expression> tableConstraintExpressions)
: this(table, ifNotExist, columnExpressions.ToReadOnlyList(), tableConstraintExpressions.ToReadOnlyList())
{
}
示例7: SqlForeignKeyConstraintExpression
public SqlForeignKeyConstraintExpression(string constraintName, IEnumerable<string> columnNames, SqlReferencesColumnExpression referencesColumnExpression)
: this(constraintName, columnNames.ToReadOnlyList(), referencesColumnExpression)
{
}
示例8: SqlQueryFormatResult
public SqlQueryFormatResult(string commandText, IEnumerable<Tuple<Type, object>> parameterValues)
: this(commandText, parameterValues.ToReadOnlyList())
{
}
示例9: ResolveField
private async Task<object> ResolveField( ExecutionContext context, ObjectGraphType parentType, object source, IEnumerable<Field> fields, List<ExecutionError> executionErrors )
{
context.CancellationToken.ThrowIfCancellationRequested();
IReadOnlyList<Field> fieldsAsReadOnlyList = fields.ToReadOnlyList();
Field field = fieldsAsReadOnlyList.First();
FieldType fieldDefinition = GetFieldDefinition(context.Schema, parentType, field);
if (fieldDefinition == null)
{
return null;
}
IReadOnlyDictionary<string, object> arguments = GetArgumentValues(context.Schema, fieldDefinition.Arguments, field.Arguments, context.Variables);
Func<ResolveFieldContext, object> defaultResolve =
ctx =>
{
return ctx.Source != null ? GetProperyValue(ctx.Source, ctx.FieldAst.Name) : null;
};
try
{
ResolveFieldContext resolveContext = new ResolveFieldContext(
field.Name,
field,
fieldDefinition,
context.Schema.FindType( fieldDefinition.Type ),
parentType,
arguments,
context.RootValue,
source,
context.Schema,
context.Operation,
context.Fragments,
context.Variables,
context.CancellationToken,
context.UserContext );
Func<ResolveFieldContext, object> resolve = fieldDefinition.Resolve ?? defaultResolve;
object result = resolve( resolveContext );
Task resultAsTask = result as Task;
if( resultAsTask != null )
{
await resultAsTask;
result = GetProperyValue( resultAsTask, "Result" );
}
if ( fieldDefinition.IsPluralIdentifyingRootField )
{
ThrowIfPluralIdentifyingRootFieldRequirementsNotMet(
result,
resolveContext );
}
__Field parentTypeAsField = parentType as __Field;
Type resultAsType = result as Type;
if ( parentTypeAsField != null &&
resultAsType != null )
{
result = context.Schema.FindType( resultAsType );
}
return await CompleteValue(
context,
context.Schema.FindType( fieldDefinition.Type ),
fieldsAsReadOnlyList,
result,
executionErrors );
}
catch( Exception exception )
{
executionErrors.Add(
new ExecutionError( string.Format( "Error trying to resolve {0}.", field.Name ), exception ) );
return null;
}
}
示例10: SqlStatementListExpression
public SqlStatementListExpression(IEnumerable<Expression> statements)
: this(statements.ToReadOnlyList())
{
}
示例11: SqlEnumDefinitionExpression
public SqlEnumDefinitionExpression(IEnumerable<string> labels)
: this(labels.ToReadOnlyList())
{
}
示例12: SqlFunctionCallExpression
public SqlFunctionCallExpression(Type type, string userDefinedFunctionName, IEnumerable<Expression> arguments)
: this(type, SqlFunction.UserDefined, arguments.ToReadOnlyList())
{
this.UserDefinedFunctionName = userDefinedFunctionName;
}
示例13: SqlColumnDefinitionExpression
public SqlColumnDefinitionExpression(string columnName, Expression columnTypeName, IEnumerable<Expression> constraintExpressions)
: this(columnName, columnTypeName, constraintExpressions.ToReadOnlyList())
{
}
示例14: SqlInsertIntoExpression
public SqlInsertIntoExpression(SqlTableExpression table, IEnumerable<string> columnNames, IEnumerable<string> returningAutoIncrementColumnNames, IEnumerable<Expression> valueExpressions)
: this(table, columnNames.ToReadOnlyList(), returningAutoIncrementColumnNames.ToReadOnlyList(), valueExpressions.ToReadOnlyList())
{
}
示例15: BindResult
public BindResult(IEnumerable<SqlColumnDeclaration> columns, IEnumerable<SqlOrderByExpression> orderings)
{
this.Columns = columns.ToReadOnlyList();
this.Orderings = orderings.ToReadOnlyList();
}