コード例 #1
0
 public object ConvertBack(object value, Type targetType,
                           object parameter, CultureInfo culture)
 {
     if (!targetType.IsEnum || value.GetType() != typeof(String))
     {
         throw new ArgumentException();
     }
     return(EnumText.GetEnumValue(value as String, targetType));
 }
コード例 #2
0
 public object Convert(object value, Type targetType,
                       object parameter, CultureInfo culture)
 {
     if (targetType != typeof(String) || !value.GetType().IsEnum)
     {
         throw new ArgumentException();
     }
     return(EnumText.GetStringValue(value as Enum));
 }