Answer the question
In order to leave comments, you need to log in
" operators?" />
How to rewrite a class without "?:" and "=>" operators?
How to rewrite the class below without the "?:" and "=>" operators and other "news" so that the code works under the .Net Framework 4.0 in VS2010?
class XmlAttributeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is IEnumerable<XmlNode> values
? values.OfType<XmlAttribute>().Select(xa => xa.Value)
: value;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
Answer the question
In order to leave comments, you need to log in
class XmlAttributeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is IEnumerable<XmlNode> values)
{
return values.OfType<XmlAttribute>().Select(xa => xa.Value);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question