HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback

Inheritance and interfaces

Describes inheritance when using the Client class and interfaces in the .NET Client API for Optimizely Search & Navigation.

When searching using the Client class, inheritance is supported. For example, you have two classes, User and Author. If you search for users, you also get matching authors back.

searchResult = client.Search<User>()
    .InField(x => x.Name)

var isUser = (searchResult.First is User);
//isUser IS true

var isAuthor = (searchResult.First is Author);
//isAuthor MIGHT be true

You also can search over types that implement a specific interface.