本文整理汇总了C#中RenderContext.Push方法的典型用法代码示例。如果您正苦于以下问题:C# RenderContext.Push方法的具体用法?C# RenderContext.Push怎么用?C# RenderContext.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RenderContext
的用法示例。
在下文中一共展示了RenderContext.Push方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public override void Render(RenderContext context)
{
var value = context.GetValue(Name);
var lambda = value as Lambda;
if (lambda != null)
{
context.Write(lambda(InnerSource()).ToString());
return;
}
var helper = value as HelperProxy;
if (helper != null)
{
helper(data =>
{
context.Enter(this);
context.Push(data);
RenderParts(context);
context.Pop();
context.Exit();
}, data =>
{
if (Inverse != null)
{
context.Enter(Inverse);
context.Push(data);
Inverse.RenderParts(context);
context.Pop();
context.Exit();
}
});
return;
}
foreach (var item in context.GetValues(Name))
{
context.Enter(this);
context.Push(item);
base.Render(context);
context.Pop();
context.Exit();
}
}
示例2: Render
public override void Render(RenderContext context)
{
foreach (var value in context.GetValues(Name))
{
context.Push(this, value);
base.Render(context);
context.Pop();
}
}
示例3: Render
public override void Render(RenderContext context)
{
// According to mustache(5), we only need to render an inverted section if the value is truthful
if (context.GetValues(Name).GetEnumerator().MoveNext()) {
return;
}
context.Push(this, true);
base.Render(context);
context.Pop();
}
示例4: Render
public override void Render(RenderContext context)
{
var lambda = context.GetValue(Name) as Lambda;
if (lambda != null)
{
context.Write(lambda(InnerSource()).ToString());
return;
}
foreach (var value in context.GetValues(Name))
{
context.Push(this, value);
base.Render(context);
context.Pop();
}
}
示例5: Render
public override void Render(RenderContext context)
{
bool checkLambda = true;
foreach (var value in context.GetValues(Name))
{
if (checkLambda)
{
checkLambda = false;
var lambda = value as Lambda;
if (lambda != null)
{
context.Write(lambda(InnerSource()).ToString());
return;
}
}
context.Push(this, value);
base.Render(context);
context.Pop();
}
}