HealthMonitoring.SelfHost.Configuration.TextMediaTypeFormatter.CanReadType C# (CSharp) Method

CanReadType() public method

public CanReadType ( Type type ) : bool
type System.Type
return bool
        public override bool CanReadType(Type type)
        {
            return type == typeof(string);
        }

Usage Example

コード例 #1
0
        public void TextMediaTypeFormatter_ReadsTypesTextAndNotOtherTypes()
        {
            var mediaTypeFormatter = new TextMediaTypeFormatter();

            Assert.True(mediaTypeFormatter.CanReadType(typeof(string)));
            Assert.False(mediaTypeFormatter.CanReadType(typeof(int)));
        }