// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc { /// /// Extension methods for . /// public static class ActionDescriptorExtensions { /// /// Gets the value of a property from the collection /// using the provided value of as the key. /// /// The type of the property. /// The action descriptor. /// The property or the default value of . public static T GetProperty([NotNull] this ActionDescriptor actionDescriptor) { object value; if (actionDescriptor.Properties.TryGetValue(typeof(T), out value)) { return (T)value; } else { return default(T); } } /// /// Sets the value of an property in the collection using /// the provided value of as the key. /// /// The type of the property. /// The action descriptor. /// The value of the property. public static void SetProperty([NotNull] this ActionDescriptor actionDescriptor, [NotNull] T value) { actionDescriptor.Properties[typeof(T)] = value; } } }