Skip to content

Commit c3e58df

Browse files
author
Ronald Barendse
committed
Obsolete HasValue method
1 parent 1d6849c commit c3e58df

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Umbraco.Core/PropertyEditors/PropertyValueConverterBase.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public virtual bool IsConverter(IPublishedPropertyType propertyType)
1616
switch (level)
1717
{
1818
case PropertyValueLevel.Source:
19-
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
19+
// the default implementation uses the old magic null & string comparisons,
20+
// other implementations may be more clever, and/or test the final converted object values
21+
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
2022
case PropertyValueLevel.Inter:
2123
return null;
2224
case PropertyValueLevel.Object:
@@ -26,16 +28,15 @@ public virtual bool IsConverter(IPublishedPropertyType propertyType)
2628
}
2729
}
2830

31+
[Obsolete("This method is not part of the IPropertyValueConverter contract and therefore not used, use IsValue instead.")]
2932
public virtual bool HasValue(IPublishedProperty property, string culture, string segment)
3033
{
31-
// the default implementation uses the old magic null & string comparisons,
32-
// other implementations may be more clever, and/or test the final converted object values
3334
var value = property.GetSourceValue(culture, segment);
34-
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string) value) == false);
35+
return value != null && (!(value is string) || string.IsNullOrWhiteSpace((string)value) == false);
3536
}
3637

3738
public virtual Type GetPropertyValueType(IPublishedPropertyType propertyType)
38-
=> typeof (object);
39+
=> typeof(object);
3940

4041
public virtual PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType)
4142
=> PropertyCacheLevel.Snapshot;

0 commit comments

Comments
 (0)