// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.Razor
{
///
/// Represents a deferred write operation in a .
///
public class HelperResult
{
private readonly Action _action;
///
/// Creates a new instance of .
///
/// The delegate to invoke when is called.
public HelperResult([NotNull] Action action)
{
_action = action;
}
///
/// Gets the delegate to invoke when is called.
///
public Action WriteAction
{
get { return _action; }
}
///
/// Method invoked to produce content from the .
///
/// The instance to write to.
public virtual void WriteTo([NotNull] TextWriter writer)
{
_action(writer);
}
}
}