PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/WCFWebApi/src/Microsoft.ApplicationServer.Http/Microsoft/ApplicationServer/Http/Description/HttpParameterExtensionMethods.cs

#
C# | 32 lines | 16 code | 3 blank | 13 comment | 2 complexity | 8431cccbc1876cfd8e18cf92efaa1072 MD5 | raw file
 1// <copyright>
 2//   Copyright (c) Microsoft Corporation.  All rights reserved.
 3// </copyright>
 4
 5namespace Microsoft.ApplicationServer.Http.Description
 6{
 7    using System.ServiceModel.Description;
 8    using Microsoft.Server.Common;
 9
10    /// <summary>
11    /// Provides extension methods for <see cref="MessagePartDescription"/>
12    /// to translate to <see cref="HttpParameter"/>.
13    /// </summary>
14    public static class HttpParameterExtensionMethods
15    {
16        /// <summary>
17        /// Creates a new <see cref="HttpParameter"/> instance from the given
18        /// <see cref="MessagePartDescription"/>.
19        /// </summary>
20        /// <param name="description">The <see cref="MessagePartDescription"/> to use.</param>
21        /// <returns>A new <see cref="HttpParameter"/> instance.</returns>
22        public static HttpParameter ToHttpParameter(this MessagePartDescription description)
23        {
24            if (description == null)
25            {
26                throw Fx.Exception.ArgumentNull("description");
27            }
28
29            return new HttpParameter(description);
30        }
31    }
32}