[corlib] Update ValueTuple implementation
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / Data / ComposingConverter.cs
1 // -------------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All Rights Reserved.
3 // -------------------------------------------------------------------
4 //From \\authoring\Sparkle\Source\1.0.1083.0\Common\Source\Framework\Data
5 namespace System.Activities.Presentation.Internal.PropertyEditing.FromExpression.Framework.Data
6 {
7     using System;
8     using System.Collections.Generic;
9     using System.ComponentModel;
10     using System.Globalization;
11     using System.Windows;
12     using System.Windows.Data;
13     using System.Diagnostics.CodeAnalysis;
14
15     [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
16     internal sealed class ComposingConverter : IValueConverter
17     {
18         private List<IValueConverter> converters = new List<IValueConverter>();
19         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
20
21         public List<IValueConverter> Converters
22         {
23             get { return this.converters; }
24         }
25
26         // IValueConverter Members
27         public object Convert(object o, Type targetType, object parameter, CultureInfo culture)
28         {
29             for (int i = 0; i < this.converters.Count; i++)
30             {
31                 o = converters[i].Convert(o, targetType, parameter, culture);
32             }
33             return o;
34         }
35
36         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
37         {
38             for (int i = this.converters.Count - 1; i >= 0; i--)
39             {
40                 value = converters[i].ConvertBack(value, targetType, parameter, culture);
41             }
42             return value;
43         }
44     }
45 }