Esempio n. 1
0
        public override void Write(TextWriter writer, Context context)
        {
            var items = context.GetValues(_expression).ToArray();

            int index = 0;

            foreach (var item in items)
            {
                try
                {
                    var meta = new Dictionary <string, object>(StringComparer.Ordinal)
                    {
                        { "@index", index },
                        { "@first", index == 0 },
                        { "@last", index == items.Length - 1 }
                    };

                    context.Push(item, meta);
                    _content.Write(writer, context);
                    index++;
                }
                finally
                {
                    context.Pop();
                }
            }
        }
Esempio n. 2
0
        public override void Write(TextWriter writer, Context context)
        {
            var items = context.GetValues(_expression).ToArray();

            int index = 0;
            foreach (var item in items)
            {
                try
                {
                    var meta = new Dictionary<string, object>(StringComparer.Ordinal)
                    {
                        {"@index", index},
                        {"@first", index == 0},
                        {"@last", index == items.Length - 1}
                    };

                    context.Push(item, meta);
                    _content.Write(writer, context);
                    index++;
                }
                finally
                {
                    context.Pop();
                }
            }
        }
Esempio n. 3
0
        public override void Write(TextWriter writer, Context context)
        {
            var value = context.GetValue(_expression);
            if (value.IsNullOrNoValue()) return;

            try
            {
                context.Push(value, null);
                _content.Write(writer, context);
            }
            catch (Exception)
            {
                context.Pop();
            }
        }
Esempio n. 4
0
        public override void Write(TextWriter writer, Context context)
        {
            var value = context.GetValue(_expression);

            if (value.IsNullOrNoValue())
            {
                return;
            }

            try
            {
                context.Push(value, null);
                _content.Write(writer, context);
            }
            catch (Exception)
            {
                context.Pop();
            }
        }