47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
using UnitsNet;
|
|
using UnitsNet.Units;
|
|
|
|
namespace CaeGlobals
|
|
{
|
|
public class StringSpecificHeatFromConverter : StringSpecificHeatConverter
|
|
{
|
|
// Variables
|
|
|
|
|
|
// Properties
|
|
|
|
|
|
// Constructors
|
|
public StringSpecificHeatFromConverter()
|
|
{
|
|
}
|
|
|
|
|
|
// Methods
|
|
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
|
{
|
|
// Convert to string
|
|
try
|
|
{
|
|
if (destinationType == typeof(string))
|
|
{
|
|
if (value is double valueDouble) return value.ToString();
|
|
}
|
|
return base.ConvertTo(context, culture, value, destinationType);
|
|
}
|
|
catch
|
|
{
|
|
return base.ConvertTo(context, culture, value, destinationType);
|
|
}
|
|
}
|
|
}
|
|
|
|
} |