Class FilterCompareTo
Filter for removing items depending on the value of a property.
Inherited Members
Namespace: EPiServer.Filters
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7Syntax
public class FilterCompareTo : PageFilterBase, IPageFilter, IContentFilter
Remarks
Will remove all items where the property PropertyName does not have the value PropertyValue.
Constructors
FilterCompareTo(String, String)
Create a compare filter and initialize the data used in comparisons.
Declaration
public FilterCompareTo(string propertyName, string propertyValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | propertyName | The name of the property to compare. |
System.String | propertyValue | The value that is used to compare the property value against. |
Properties
Condition
Filter comparer for non-text comparisons.
Declaration
public CompareCondition Condition { get; set; }
Property Value
Type | Description |
---|---|
CompareCondition |
Remarks
Use this class to compare numeric and date properties. See the CompareCondition enum for possible values.
For text comparisons, see the StringComparison property.
PropertyName
The name of the property to compare the value to.
Declaration
public string PropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PropertyValue
The value used to compare PropertyName against.
Declaration
public string PropertyValue { get; set; }
Property Value
Type | Description |
---|---|
System.String | The value must always be a string. If the value is a number, a date etc, convert it to a string. |
Remarks
If the value is text, define type of comparison in the StringComparison property.
If the value is non-textual (numeric, date etc), define type of comparison in the Condition property.
StringComparison
Gets or sets the string comparison that is used to compare strings.
Declaration
public StringComparison StringComparison { get; set; }
Property Value
Type | Description |
---|---|
System.StringComparison | The string comparison that is used to compare strings. |
Methods
Filter(PageDataCollection)
Filters the specified pages.
Declaration
public override void Filter(PageDataCollection pages)
Parameters
Type | Name | Description |
---|---|---|
PageDataCollection | pages | The pages that should be filtered. |
Overrides
ShouldFilter(IContent)
If the content should be filtered.
Declaration
public override bool ShouldFilter(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content |
Returns
Type | Description |
---|---|
System.Boolean | True if the filter will remove the page; otherwise false. |
Overrides
ShouldFilter(PageData)
If the page should be filtered.
Declaration
public override bool ShouldFilter(PageData page)
Parameters
Type | Name | Description |
---|---|---|
PageData | page | The page that you want to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the filter will remove the page; otherwise false. |