user2352554
user2352554

Reputation: 531

how to pass an array of methods in C#

In NEST, Elasticsearch library for .NET. For highlighting on query.

In Highlight method of NEST, How we can pass an array of actions as parameter to onFields(Action<HighlightFieldDescriptor<T>>[] fielddata) method?

thanks.

Upvotes: 0

Views: 108

Answers (1)

Manolis
Manolis

Reputation: 738

You could try the below:

var highlighters = new Action<HighlightFieldDescriptor<YourObject>>[3];
highlighters[0] = h => h.OnField("field1");
highlighters[1] = h => h.OnField("field2");
highlighters[2] = h => h.OnField("field3");

searchDescriptor.Highlight(h => h.OnFields(highlighters));

Upvotes: 1

Related Questions