I’m using LINQ Reporting Engine from Aspose.Words for .NET version 22.6.0.
I’d like to ask if there are plans to expand the Enumeration Extension Methods set to include a ToDictionary() method and/or allow the use of lambdas to create a custom handler on my own.
Ideally, I would like to be able to call from the template the built-in method :
Collection.ToDictionary(n => n.Name)
Additionally, it would be great to allow lambdas to be passed as arguments to custom functions e.g:
public class ListHandler
{
public IEnumerable<object> MutateList(IEnumerable<object> o, Func<object, bool> p)
{
var c = o.Where(p);
(...)
return c;
}
}
The usage in the template would be as follows: <<var [l = ListHandler.MutateList(Collection, n => n.Name)]>>
Using predicates, I would be able to create a ToDictionary() method on my own.
LINQ Reporting Engine supports a subset of C# language features in its template syntax with several limitations described at Composing Expressions. Unfortunately, lambda functions used in a template are not interchangeable with delegates as per Using Lambda Functions:
LINQ Reporting Engine enables you to use lambda functions only as arguments of built-in enumeration extension methods in template expressions.
Note – Lambda functions declared within template expressions are not interchangeable with delegates. Thus, you can not pass delegates as arguments to built-in enumeration extension methods.
Theare are technical reasons behind this restriction, so we are not about to support conversion of template lambdas to .NET delegates and vice versa.
Regarding support of the ToDictionary extension method, unfortunately, it is too complex from a technical point of view, because of the restriction on generic types usage as per Working with Types.
However, if you can go only with Dictionary<object, object> initialized from a collection within a template, then we could provide an example of how to do this. Please let us know, if you need the example.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.