示例#1
0
 /// <inheritdoc />
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string) && value is IHash hash)
     {
         return(HashStringRepresentation.Process(hash));
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
示例#2
0
 /// <inheritdoc />
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
 {
     return(value is string inputString
         ? HashStringRepresentation.Retrieve(inputString)
         : base.ConvertFrom(context, culture, value));
 }
示例#3
0
 /// <inheritdoc />
 public override string ToString()
 => HashStringRepresentation.Process(this);