How can i use indexer to bind data?

edited 5:19AM in FastReport .NET
I have class:
   public class ReportItem
    {
        private List<ItemData> Data { get; set; }
        public DateTime Date { get; set; }
        public double? this[string key]
        {
            get
            {
                return (from item in Data
                        where item.Tag.Code.ToLower().Equals(key.ToLower())
                        select item.Value).FirstOrDefault();
            }
        }
        public ReportItem(DateTime date, List<ItemData> data)
        {
            Date = date;
            Data = data;
        }
    }

How can i user indexer ReportItem[columnName] to bind Data in report?

Comments

  • edited 5:19AM
    Hello,

    You should provide an IEnumerable instance to the RegisterData method in order to use it in a report.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.