// 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.Net.Http.Formatting; using System.Net.Http.Headers; namespace System.Net.Http { /// /// Generic form of . /// /// The type of object this class will contain. public class ObjectContent : ObjectContent { /// /// Initializes a new instance of the class. /// /// The value of the object this instance will contain. /// The formatter to use when serializing the value. public ObjectContent(T value, MediaTypeFormatter formatter) : this(value, formatter, (MediaTypeHeaderValue)null) { } /// /// Initializes a new instance of the class. /// /// The value of the object this instance will contain. /// The formatter to use when serializing the value. /// The authoritative value of the content's Content-Type header. Can be null in which case the /// formatter's default content type will be used. public ObjectContent(T value, MediaTypeFormatter formatter, string mediaType) : this(value, formatter, BuildHeaderValue(mediaType)) { } /// /// Initializes a new instance of the class. /// /// The value of the object this instance will contain. /// The formatter to use when serializing the value. /// The authoritative value of the content's Content-Type header. Can be null in which case the /// formatter's default content type will be used. public ObjectContent(T value, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType) : base(typeof(T), value, formatter, mediaType) { } } }