Cimbalino.Phone.Toolkit.Converters.StringToUppercaseConverter.Convert C# (CSharp) Method

Convert() public method

Formats a string value to upper case.
public Convert ( object value, Type targetType, object parameter, System culture ) : object
value object The value produced by the binding source.
targetType System.Type The type of the binding target property.
parameter object The converter parameter to use.
culture System The culture to use in the converter.
return object
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return null;
            }

            return ((string)_stringFormatConverter.Convert(value, targetType, parameter, culture)).ToUpper(culture);
        }

Usage Example

        public void ConvertWithStringReturnsUppercaseString()
        {
            var converter = new StringToUppercaseConverter();

            var expected = "MY STRING!";
            var actual = converter.Convert("My String!", typeof(string), null, CultureInfo.CurrentCulture);

            Assert.AreEqual(actual, expected);
        }
StringToUppercaseConverter