本文整理汇总了C#中System.Linq.Expressions.ListInitExpression类的典型用法代码示例。如果您正苦于以下问题:C# ListInitExpression类的具体用法?C# ListInitExpression怎么用?C# ListInitExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListInitExpression类属于System.Linq.Expressions命名空间,在下文中一共展示了ListInitExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateListInit
protected ListInitExpression UpdateListInit(ListInitExpression init, NewExpression nex, IEnumerable<ElementInit> initializers)
{
if (nex != init.NewExpression || initializers != init.Initializers) {
return Expression.ListInit(nex, initializers);
}
return init;
}
示例2: UpdateListInit
protected static ListInitExpression UpdateListInit(ListInitExpression node, NewExpression nex,
IEnumerable<ElementInit> initializers)
{
if (node.NewExpression != nex || node.Initializers != initializers)
{
return Expression.ListInit(nex, initializers);
}
return node;
}
示例3: VisitListInit
protected override Expression VisitListInit(ListInitExpression node)
{
// If we here, than eval the whole block failed, don't touch constructor!
_allowEval = false;
var newExpr = VisitAndConvert(node.NewExpression, "VisitListInit");
_allowEval = true;
// ReSharper disable once AssignNullToNotNullAttribute
return node.Update(newExpr, Visit(node.Initializers, VisitElementInit));
}
示例4: VisitListInit
internal override Expression VisitListInit(ListInitExpression init)
{
throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjectionToEntity(this.type, init.ToString()));
}
示例5: VisitListInit
internal override Expression VisitListInit(ListInitExpression init)
{
throw new NotSupportedException(Strings.ALinq_ListInitNotSupported);
}
示例6: VisitListInit
protected virtual System.Linq.Expressions.Expression VisitListInit(ListInitExpression init)
{
NewExpression n = VisitNew(init.NewExpression);
IEnumerable<ElementInit> initializers = VisitElementInitializerList(init.Initializers);
// ReSharper disable once PossibleUnintendedReferenceComparison
if(n != init.NewExpression || initializers != init.Initializers)
{
return System.Linq.Expressions.Expression.ListInit(n, initializers);
}
return init;
}
示例7: Visit
public virtual void Visit(ListInitExpression expression) {
if (VisitListInit != null)
VisitListInit(expression);
}
示例8: VisitListInit
protected override Expression VisitListInit(ListInitExpression init)
{
this.Visit(init.NewExpression);
this.Write(" {");
this.WriteLine(Indentation.Inner);
this.VisitElementInitializerList(init.Initializers);
this.WriteLine(Indentation.Outer);
this.Write("}");
return init;
}
示例9: VisitListInit
/// <summary>
/// Visit a list initializatio expression.
/// </summary>
/// <param name="listInitExp"></param>
/// <returns></returns>
protected virtual Expression VisitListInit(ListInitExpression listInitExp)
{
NewExpression n = VisitNew(listInitExp.NewExpression);
IEnumerable<ElementInit> initializers = VisitElementInitializerList(listInitExp.Initializers);
return n != listInitExp.NewExpression || initializers != listInitExp.Initializers
? Expression.ListInit(n, initializers)
: listInitExp;
}
示例10: ListInitExpressionMutator
public ListInitExpressionMutator(ListInitExpression expression)
{
ListInitExpression = expression;
}
示例11: VisitListInit
internal virtual Expression VisitListInit(ListInitExpression init)
{
var n = VisitNew(init.NewExpression);
var initializers = VisitElementInitializerList(init.Initializers);
if (n != init.NewExpression
|| initializers != init.Initializers)
{
return Expression.ListInit(n, initializers);
}
return init;
}
示例12: VisitListInit
protected virtual Expression VisitListInit(ListInitExpression init, Stack<string> stack, Stack<IElasticPropertyAttribute> properties)
{
NewExpression n = this.VisitNew(init.NewExpression, stack, properties);
IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers, stack, properties);
if (n != init.NewExpression || initializers != init.Initializers)
{
return Expression.ListInit(n, initializers);
}
return init;
}
示例13: VisitListInit
/// <summary>
/// Visits a ListInitExpression.
/// </summary>
/// <param name="node">The ListInitExpression.</param>
/// <returns>The ListInitExpression (possibly modified).</returns>
protected virtual Expression VisitListInit(ListInitExpression node)
{
NewExpression n = VisitNew(node.NewExpression);
IEnumerable<ElementInit> initializers = VisitElementInitList(node.Initializers);
return UpdateListInit(node, n, initializers);
}
示例14: ListInitExpressionProxy
public ListInitExpressionProxy(ListInitExpression node) {
_node = node;
}
示例15: WriteEx
private static IList<string> WriteEx(ListInitExpression expression, string header, int depth)
{
var lines = new List<string> { WriteHeader(expression, header, depth++) };
lines.AddRange(Write(expression.NewExpression, "New", depth));
for (int i = 0; i < expression.Initializers.Count; i++)
{
lines.Add(WriteLiteral(expression.Initializers[i].AddMethod.Name, string.Format("Method{0:0##}", i), depth));
for (int j = 0; j < expression.Initializers[i].Arguments.Count; j++)
{
lines.AddRange(Write(expression.Initializers[i].Arguments[j], string.Format("#{0:0##}", j), depth + 1));
}
}
return lines;
}