public static XamlConvertResult TryConvertCache(ref ConvertCacheStore cacheStore, Type targetType) { if (targetType == null) { return(new XamlConvertResult(null, CreateException(cacheStore.Value, null, "Target type is not specified"))); } if (cacheStore.CachedType == targetType) { return(new XamlConvertResult(cacheStore.CachedValue, null)); } var actualValue = cacheStore.Value.IsUnset() ? null : cacheStore.Value; var result = TryConvertValue(actualValue, targetType); cacheStore.CachedValue = result.IsValid ? result.Result : targetType.CreateDefaultValue(); if (CanCacheValueOfType(targetType)) { cacheStore.CachedType = targetType; } return(result); }
public static object ConvertCache(ref ConvertCacheStore cacheStore, Type targetType) { return(TryConvertCache(ref cacheStore, targetType).Result); }
public XamlConvertCache(object value, Type targetType) { _cacheStore = new ConvertCacheStore(value); XamlStaticConverter.ConvertCache(ref _cacheStore, targetType); }
public XamlConvertCache(object value) { _cacheStore = new ConvertCacheStore(value); }