Class IndexedArrayItem<TContent>
Represents an item in an array that stores its own index and the total count.
Inheritance
Namespace: Umbraco.Core.Models.PublishedContent
Assembly: Umbraco.Core.dll
Syntax
public class IndexedArrayItem<TContent>
Type Parameters
Name | Description |
---|---|
TContent | The type of the content. |
Constructors
View SourceIndexedArrayItem(TContent, Int32)
Initializes a new instance of the IndexedArrayItem<TContent> class.
Declaration
public IndexedArrayItem(TContent content, int index)
Parameters
Type | Name | Description |
---|---|---|
TContent | content | The content. |
System.Int32 | index | The index. |
Properties
View SourceContent
Gets the content.
Declaration
public TContent Content { get; }
Property Value
Type | Description |
---|---|
TContent | The content. |
Index
Gets the index.
Declaration
public int Index { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The index. |
TotalCount
Gets the total count.
Declaration
public int TotalCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The total count. |
Methods
View SourceIsEven()
Determines whether this item is at an even index.
Declaration
public bool IsEven()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsEven(String)
If this item is at an even index, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsEven(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsEven(String, String)
If this item is at an even index, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsEven(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsFirst()
Determines whether this item is the first.
Declaration
public bool IsFirst()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsFirst(String)
If this item is the first, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsFirst(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsFirst(String, String)
If this item is the first, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsFirst(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsIndex(Int32)
Determines whether this item is at the specified index
.
Declaration
public bool IsIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsIndex(Int32, String)
If this item is at the specified index
, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsIndex(int index, string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsIndex(Int32, String, String)
If this item is at the specified index
, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsIndex(int index, string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsLast()
Determines whether this item is the last.
Declaration
public bool IsLast()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsLast(String)
If this item is the last, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsLast(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsLast(String, String)
If this item is the last, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsLast(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsModZero(Int32)
Determines whether this item is at an index that can be divided by the specified modulus
.
Declaration
public bool IsModZero(int modulus)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsModZero(Int32, String)
If this item is at an index that can be divided by the specified modulus
, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsModZero(int modulus, string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsModZero(Int32, String, String)
If this item is at an index that can be divided by the specified modulus
, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsModZero(int modulus, string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotFirst()
Determines whether this item is not the first.
Declaration
public bool IsNotFirst()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsNotFirst(String)
If this item is not the first, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsNotFirst(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotFirst(String, String)
If this item is not the first, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsNotFirst(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotIndex(Int32)
Determines whether this item is not at the specified index
.
Declaration
public bool IsNotIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsNotIndex(Int32, String)
If this item is not at the specified index
, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsNotIndex(int index, string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotIndex(Int32, String, String)
If this item is at the specified index
, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsNotIndex(int index, string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotLast()
Determines whether this item is not the last.
Declaration
public bool IsNotLast()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsNotLast(String)
If this item is not the last, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsNotLast(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotLast(String, String)
If this item is not the last, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsNotLast(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotModZero(Int32)
Determines whether this item is not at an index that can be divided by the specified modulus
.
Declaration
public bool IsNotModZero(int modulus)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsNotModZero(Int32, String)
If this item is not at an index that can be divided by the specified modulus
, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsNotModZero(int modulus, string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsNotModZero(Int32, String, String)
If this item is not at an index that can be divided by the specified modulus
, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsNotModZero(int modulus, string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | modulus | The modulus. |
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsOdd()
Determines whether this item is at an odd index.
Declaration
public bool IsOdd()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsOdd(String)
If this item is at an odd index, the HTML encoded valueIfTrue
will be returned; otherwise, System.String.Empty.
Declaration
public HtmlString IsOdd(string valueIfTrue)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |
IsOdd(String, String)
If this item is at an odd index, the HTML encoded valueIfTrue
will be returned; otherwise, valueIfFalse
.
Declaration
public HtmlString IsOdd(string valueIfTrue, string valueIfFalse)
Parameters
Type | Name | Description |
---|---|---|
System.String | valueIfTrue | The value if |
System.String | valueIfFalse | The value if |
Returns
Type | Description |
---|---|
System.Web.HtmlString | The HTML encoded value. |