Class StringFragmentCollection
Container for string fragments
Inheritance
Namespace: EPiServer.Core.Html.StringParsing
Assembly: EPiServer.dll
Version: 12.0.3Syntax
public class StringFragmentCollection : Collection<IStringFragment>
Constructors
StringFragmentCollection()
Initializes a new instance of the StringFragmentCollection class.
Declaration
public StringFragmentCollection()
StringFragmentCollection(IEnumerable<IStringFragment>)
Initializes a new instance of the StringFragmentCollection class with the provided fragments.
Declaration
public StringFragmentCollection(IEnumerable<IStringFragment> stringFragments)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IStringFragment> | stringFragments | The string fragments. |
StringFragmentCollection(IList<IStringFragment>)
Initializes a new instance of the StringFragmentCollection class.
Declaration
public StringFragmentCollection(IList<IStringFragment> stringFragments)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<IStringFragment> | stringFragments | The string fragments. |
Properties
IsReadOnly
Gets a value indicating whether this instance is read only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Methods
ClearItems()
Clears all string fragments from the collection. Will raise theClearedFragments event once completed.
Declaration
protected override void ClearItems()
GetFilteredFragments()
Gets the string fragments for the current principal.
Declaration
public StringFragmentCollection GetFilteredFragments()
Returns
Type | Description |
---|---|
StringFragmentCollection | A StringFragmentCollection with the fragments that the current principal should see. |
Remarks
This applies filtering for visitor group settings but but not access rights or filtering on publishing status.
GetFilteredFragments(IPrincipal)
Gets the string fragments accessable for a given principal.
Declaration
public StringFragmentCollection GetFilteredFragments(IPrincipal principal)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Principal.IPrincipal | principal | The principal. |
Returns
Type | Description |
---|---|
StringFragmentCollection | A StringFragmentCollection with the fragments that the given principal should see. |
InsertItem(Int32, IStringFragment)
Inserts the item. Will call the event AddingFragment before the item gets added.
Declaration
protected override void InsertItem(int index, IStringFragment item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
IStringFragment | item | The item. |
RemoveItem(Int32)
Removes the string fragment at the provided position. Will raise the RemovedFragment event once completed.
Declaration
protected override void RemoveItem(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index of the fragment to remove. |
SetItem(Int32, IStringFragment)
Sets the item. Will call the event ChangingFragment before the item gets changed.
Declaration
protected override void SetItem(int index, IStringFragment item)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
IStringFragment | item | The item. |
ToReadOnly()
Gets a read only version of the current collection.
Declaration
public virtual StringFragmentCollection ToReadOnly()
Returns
Type | Description |
---|---|
StringFragmentCollection | A read-only version of this collection. |
Events
AddingFragment
Event which will be trigged before an fragment gets added.
Declaration
public event EventHandler<StringFragmentEventArgs> AddingFragment
Event Type
Type | Description |
---|---|
System.EventHandler<StringFragmentEventArgs> |
ChangingFragment
Event which will be trigged before an fragment gets changed.
Declaration
public event EventHandler<StringFragmentEventArgs> ChangingFragment
Event Type
Type | Description |
---|---|
System.EventHandler<StringFragmentEventArgs> |
ClearedFragments
Raised before all string fragments are cleared from the collection.
Declaration
public event EventHandler ClearedFragments
Event Type
Type | Description |
---|---|
System.EventHandler |
RemovedFragment
Raised before a string fragment is removed from the collection
Declaration
public event EventHandler<StringFragmentEventArgs> RemovedFragment
Event Type
Type | Description |
---|---|
System.EventHandler<StringFragmentEventArgs> |