Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class StringFragmentCollection

Container for string fragments

Inheritance
System.Object
System.Collections.ObjectModel.Collection<IStringFragment>
StringFragmentCollection
Implements
System.Collections.Generic.IList<IStringFragment>
System.Collections.Generic.ICollection<IStringFragment>
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IReadOnlyList<IStringFragment>
System.Collections.Generic.IReadOnlyCollection<IStringFragment>
System.Collections.Generic.IEnumerable<IStringFragment>
System.Collections.IEnumerable
Inherited Members
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Add(EPiServer.Core.Html.StringParsing.IStringFragment)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Clear()
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.CopyTo(EPiServer.Core.Html.StringParsing.IStringFragment[], System.Int32)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Contains(EPiServer.Core.Html.StringParsing.IStringFragment)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.GetEnumerator()
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.IndexOf(EPiServer.Core.Html.StringParsing.IStringFragment)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Insert(System.Int32, EPiServer.Core.Html.StringParsing.IStringFragment)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Remove(EPiServer.Core.Html.StringParsing.IStringFragment)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.RemoveAt(System.Int32)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.get_Item(System.Int32)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.Add(System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.Contains(System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.IndexOf(System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.Remove(System.Object)
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Count
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Items
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.Item[System.Int32]
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.Generic.ICollection<EPiServer.Core.Html.StringParsing.IStringFragment>.IsReadOnly
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.ICollection.IsSynchronized
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.ICollection.SyncRoot
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.Item[System.Int32]
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.IsReadOnly
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.System.Collections.IList.IsFixedSize
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core.Html.StringParsing
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public class StringFragmentCollection : Collection<IStringFragment>, IList<IStringFragment>, ICollection<IStringFragment>, IList, ICollection, IReadOnlyList<IStringFragment>, IReadOnlyCollection<IStringFragment>, IEnumerable<IStringFragment>, IEnumerable

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

true if this instance is read only; otherwise, false.

Methods

ClearItems()

Clears all string fragments from the collection. Will raise theClearedFragments event once completed.

Declaration
protected override void ClearItems()
Overrides
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.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.

Overrides
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.InsertItem(System.Int32, EPiServer.Core.Html.StringParsing.IStringFragment)

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.

Overrides
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.RemoveItem(System.Int32)

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.

Overrides
System.Collections.ObjectModel.Collection<EPiServer.Core.Html.StringParsing.IStringFragment>.SetItem(System.Int32, EPiServer.Core.Html.StringParsing.IStringFragment)

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>

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods