d51ed1db6ca9ccaa4d0fb046228b0ae79c52af6c
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / Data / IsNullConverter.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.ComponentModel;
9     using System.Diagnostics;
10     using System.Globalization;
11     using System.Windows.Data;
12     using System.Diagnostics.CodeAnalysis;
13
14     // <summary>
15     // (nullable-to-bool) Returns true if the value is null, false otherwise.
16     // </summary>
17     [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
18     internal class IsNullConverter : IValueConverter
19     {
20         // IValueConverter Members
21         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
22         {
23             return value == null;
24         }
25
26         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27         {
28             Debug.Fail("IsNullConverter can only be used for BindType=OneWay");
29             return null;
30         }
31     }
32 }