Example #1
        /// <summary>
        /// Converts a value to the specified type.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        /// <param name="originalType">The value's original type.</param>
        /// <param name="conversionType">The type to which to convert the value.</param>
        /// <param name="formatString">The format string used to convert objects to strings.</param>
        /// <param name="coerceToString">A value indicating whether to coerce Object values to String values if no valid type conversion exists.</param>
        /// <returns>The converted value.</returns>
        public static Object ConvertValue(Object value, Type originalType, Type conversionType, String formatString, Boolean coerceToString)
            if (IsStringType(conversionType, coerceToString))
                var stringValue = ConvertUsingToString(value, originalType, formatString);
                return (conversionType == typeof(VersionedStringSource)) ?
                    new VersionedStringSource((String)stringValue) : stringValue;

            if (conversionType == typeof(StringBuilder))
                return new StringBuilder(value?.ToString());

            if (conversionType == typeof(VersionedStringBuilder))
                return new VersionedStringBuilder(value?.ToString());

            return ConvertUsingTypeConverter(value, originalType, conversionType);
Example #2
 private Boolean example2(Object value)
     var value2 = value != null ? value.ToString() : null;
     var value3 = value?.ToString();
     return value2 == value3;
 // Works in old debugger (managed compatibility mode) only
 public static Boolean CollectUnknownMimeTypes(Object c, Object value)
     return true;