本文整理汇总了C#中System.ComponentModel.EnumConverter.CanConvertFrom方法的典型用法代码示例。如果您正苦于以下问题:C# EnumConverter.CanConvertFrom方法的具体用法?C# EnumConverter.CanConvertFrom怎么用?C# EnumConverter.CanConvertFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ComponentModel.EnumConverter
的用法示例。
在下文中一共展示了EnumConverter.CanConvertFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanConvertFrom
public void CanConvertFrom ()
{
EnumConverter converter = new EnumConverter (typeof (E));
Assert.IsTrue (converter.CanConvertFrom (typeof (string)), "#A1");
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum)), "#A2");
Assert.IsFalse (converter.CanConvertFrom (typeof (object)), "#A3");
Assert.IsFalse (converter.CanConvertFrom (typeof (int)), "#A4");
Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#A5");
Assert.IsFalse (converter.CanConvertFrom (typeof (string [])), "#A6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertFrom (typeof (Enum [])), "#A7");
#else
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum [])), "#A7");
#endif
converter = new EnumConverter (typeof (E2));
Assert.IsTrue (converter.CanConvertFrom (typeof (string)), "#B1");
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum)), "#B2");
Assert.IsFalse (converter.CanConvertFrom (typeof (object)), "#B3");
Assert.IsFalse (converter.CanConvertFrom (typeof (int)), "#B4");
Assert.IsTrue (converter.CanConvertFrom (typeof (InstanceDescriptor)), "#B5");
Assert.IsFalse (converter.CanConvertFrom (typeof (string [])), "#B6");
#if NET_2_0
Assert.IsTrue (converter.CanConvertFrom (typeof (Enum [])), "#B7");
#else
Assert.IsFalse (converter.CanConvertFrom (typeof (Enum [])), "#B7");
#endif
}