// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; namespace Microsoft.AspNetCore.Mvc.Razor { /// /// Result of locating a . /// public readonly struct RazorPageResult { /// /// Initializes a new instance of for a successful discovery. /// /// The name of the page that was found. /// The located . public RazorPageResult(string name, IRazorPage page) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (page == null) { throw new ArgumentNullException(nameof(page)); } Name = name; Page = page; SearchedLocations = null; } /// /// Initializes a new instance of for an unsuccessful discovery. /// /// The name of the page that was not found. /// The locations that were searched. public RazorPageResult(string name, IEnumerable searchedLocations) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (searchedLocations == null) { throw new ArgumentNullException(nameof(searchedLocations)); } Name = name; Page = null; SearchedLocations = searchedLocations; } /// /// Gets the name or the path of the page being located. /// public string Name { get; } /// /// Gets the if found. /// /// This property is null if the page was not found. public IRazorPage Page { get; } /// /// Gets the locations that were searched when could not be found. /// /// This property is null if the page was found. public IEnumerable SearchedLocations { get; } } }