mustache.KeyScope.CreateChildScope C# (CSharp) Method

CreateChildScope() public method

Creates a child scope that searches for keys in the given object.
public CreateChildScope ( object source ) : KeyScope
source object The object to search for keys in.
return KeyScope
        public KeyScope CreateChildScope(object source)
        {
            KeyScope scope = new KeyScope(source, this);
            return scope;
        }

Usage Example

 /// <summary>
 /// Gets the context to use when building the inner text of the tag.
 /// </summary>
 /// <param name="writer">The text writer passed</param>
 /// <param name="scope">The current scope.</param>
 /// <param name="arguments">The arguments passed to the tag.</param>
 /// <returns>The scope to use when building the inner text of the tag.</returns>
 public override IEnumerable<NestedContext> GetChildContext(TextWriter writer, KeyScope scope, Dictionary<string, object> arguments)
 {
     object value = arguments[collectionParameter];
     IEnumerable enumerable = value as IEnumerable;
     if (enumerable == null)
     {
         yield break;
     }
     foreach (object item in enumerable)
     {
         yield return new NestedContext() { KeyScope = scope.CreateChildScope(item), Writer = writer };
     }
 }
All Usage Examples Of mustache.KeyScope::CreateChildScope