How to access a Dictionary<string, string> property easy

Stimulsoft Reports.NET discussion
Post Reply
vorauler
Posts: 71
Joined: Wed Jul 15, 2009 1:20 am

How to access a Dictionary<string, string> property easy

Post by vorauler »

Hello

We have following object:
class Sample
{
public string Tag { get; set; }
public string Description { get; set; }
public Dictionary TextElemente { get; set; }
}

In the report we can access a element of the Dictionary property via
{((System.Collections.Generic.Dictionary)Sample.TextElemente)["B"]}.

Is it possible to access the property without the cast like {Sample.TextElemente["B"]}

Ralf
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

How to access a Dictionary<string, string> property easy

Post by Alex K. »

Hello,

Please add in your report

using System.Collections.Generic;

Thank you.
vorauler
Posts: 71
Joined: Wed Jul 15, 2009 1:20 am

How to access a Dictionary<string, string> property easy

Post by vorauler »

Hello

If I add using System.Collections.Generic and remove the cast I get the error:
Cannot apply indexing with [] to an expression of type object

Ralf
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

How to access a Dictionary<string, string> property easy

Post by Alex K. »

Hello,

Please send us a sample report with data on support@stimulsoft.com.

Thank you.
Post Reply