Microsoft.Tools.WindowsInstaller.EncodingConverter.CanConvertTo C# (CSharp) Method

CanConvertTo() public method

Returns True when destinationType is a String or Int32.
public CanConvertTo ( ITypeDescriptorContext context, Type destinationType ) : bool
context ITypeDescriptorContext Additional context for conversion.
destinationType System.Type The type of the destination object.
return bool
        public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
        {
            return typeof(string) == destinationType || IsNumeric(destinationType) || base.CanConvertTo(context, destinationType);
        }

Usage Example

Ejemplo n.º 1
0
        public void ConvertToInteger()
        {
            var converter = new EncodingConverter();
            Assert.IsTrue(converter.CanConvertTo(typeof(int)), "Cannot convert to an integer.");

            var value = (int)converter.ConvertTo(Encoding.UTF8, typeof(int));
            Assert.AreEqual<int>(65001, value, "Could not convert to an integer.");
        }
All Usage Examples Of Microsoft.Tools.WindowsInstaller.EncodingConverter::CanConvertTo