markus / KCOM / Converters / IListToIListCountConverter.cs @ df2e7646
이력 | 보기 | 이력해설 | 다운로드 (894 Bytes)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Globalization; |
4 |
using System.Linq; |
5 |
using System.Text; |
6 |
using System.Threading.Tasks; |
7 |
using System.Windows.Data; |
8 |
|
9 |
namespace KCOM.Converters |
10 |
{ |
11 |
public class IListToIListCountConverter : IValueConverter |
12 |
{ |
13 |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
14 |
{ |
15 |
var list = value as IEnumerable<object>; |
16 |
|
17 |
if (list != null) |
18 |
{ |
19 |
return list.Count(); |
20 |
} |
21 |
else |
22 |
{ |
23 |
return 0; |
24 |
//throw new Exception("IListToIListCountConverter Error. Value is Not IList Type."); |
25 |
} |
26 |
} |
27 |
|
28 |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
29 |
{ |
30 |
throw new NotImplementedException(); |
31 |
} |
32 |
} |
33 |
} |