[corlib] Avoid unnecessary ephemeron array resizes
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / FromExpression / Framework / Data / NullToBoolConverter.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;
9     using System.ComponentModel;
10     using System.Diagnostics;
11     using System.Globalization;
12     using System.Reflection;
13     using System.Windows;
14     using System.Windows.Controls;
15     using System.Windows.Data;
16     using System.Diagnostics.CodeAnalysis;
17     using System.Runtime;
18
19     // <summary>
20     // Converts non-null to true, and null to false.
21     // </summary>
22     [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
23     internal class NullToBoolConverter : IValueConverter
24     {
25         // IValueConverter Implementation
26
27         public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture)
28         {
29             Fx.Assert(false, "NullToBoolConverter can only be used for forward conversion.");
30             return null;
31         }
32
33         public object Convert(object o, Type targetType, object parameter, CultureInfo culture)
34         {
35             return o != null;
36         }
37
38     }
39 }