System.Net.Mime.ContentType.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString() { throw null; }
        public override bool Equals(object rparam) { throw null; }

Usage Example

        public bool CanFormatResponse(ContentType acceptHeaderElement, bool matchCharset, out ContentType contentType)
        {
            if (acceptHeaderElement == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("acceptHeaderElement");
            }

            // Scrub the content type so that it is only mediaType and the charset
            string charset = acceptHeaderElement.CharSet;
            contentType = new ContentType(acceptHeaderElement.MediaType);
            contentType.CharSet = this.DefaultContentType.CharSet;
            string contentTypeStr = contentType.ToString();
            
            if (matchCharset &&
                !string.IsNullOrEmpty(charset) &&
                !string.Equals(charset, this.DefaultContentType.CharSet, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (this.contentTypeMapper != null &&
                this.contentTypeMapper.GetMessageFormatForContentType(contentType.MediaType) == this.ContentFormat)
            {
                return true;
            }

            if (this.Encoder.IsContentTypeSupported(contentTypeStr) && 
                (charset == null || contentType.CharSet == this.DefaultContentType.CharSet))
            {
                return true;
            }
            contentType = null;
            return false;
        }
All Usage Examples Of System.Net.Mime.ContentType::ToString