Torna al Thread

public class TotalSumConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var users = value as IEnumerable<object>; if (users == null) return "$0.00"; double sum = 0; foreach (var u in users) { sum += ((User)u).Total; } return sum.ToString("c"); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5