Class ClientResourceComparer

Client resource comparer that is used to order client resources to guess the best resource loading sequence in the browser. Usually is used for initial simple sorting before sorting by dependencies.

Inheritance
System.Object
ClientResourceComparer
Implements
System.Collections.Generic.IComparer<ClientResource>
Inherited Members
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.Framework.Web.Resources
Assembly: EPiServer.Framework.dll
Version: 8.11.0
Syntax
public class ClientResourceComparer : IComparer<ClientResource>
Remarks

The following order of client resources on the page is considered as "the best" sequence when resources can be loaded by browser in parallel:

  1. Static CSS references.
  2. Inline CSS blocks.
  3. Inline HTML injections.
  4. Static JavaScript references.
  5. Inline JavaScipt blocks.
Sort index and the number of dependencies are considered only if it is not possible to decide which of resources is greater by type and referenced path. Resource is considered as greater than other if its sort index is greater of sort index of other resource with the same name or if resource has more dependencies than other resource. Resulting order ofthe client resources should be refined basing on dependencies, indexes and possibilities to create bundles.

Properties

Default

Gets the default client resource comparer.

Declaration
public static ClientResourceComparer Default { get; }
Property Value
Type Description
ClientResourceComparer

Methods

Compare(ClientResource, ClientResource)

Compares two client resources and returns a value indicating whether one should be rendered before the other.

Declaration
public int Compare(ClientResource x, ClientResource y)
Parameters
Type Name Description
ClientResource x

The first client resource to compare.

ClientResource y

The second client resource to compare.

Returns
Type Description
System.Int32

Value Condition Less than zero x is less than y. Zero x equals y. Greater than zero x is greater than y.

Implements

System.Collections.Generic.IComparer<T>