I have been reading about ReactiveUI, and have reached a problem on the very first example! On the project's website, the following code is given:
public class SearchViewModel : ISearchViewModel
{
public ReactiveList<SearchResults> SearchResults { get; set; }
private string searchQuery;
public string SearchQuery {
get { return searchQuery; }
set { this.RaiseAndSetIfChanged(ref searchQuery, value); }
}
public ReactiveCommand<List<SearchResults>> Search { get; set; }
public ISearchService SearchService { get; set; }
}
And then,
public SearchViewModel(ISearchService searchService = null) : ReactiveObject, IRoutableViewHost
{
SearchService = searchService ?? Locator.Current.GetService<ISearchService>();
... // example continues
}
However, I can't make any sense of the syntax used for the second part. It seems like it is half a constructor, and half a class definition.
What is it supposed to mean, exactly? I can't make a simple, equivalent example compile - is there some language/compiler extension at work?