Class ElementFieldList
- Namespace
- JJMasterData.Commons.Data.Entity.Models
- Assembly
- JJMasterData.Commons.dll
Represents a collection of ElementField objects with additional utility methods for field management.
public class ElementFieldList : IList<ElementField>, ICollection<ElementField>, IEnumerable<ElementField>, IEnumerable
- Inheritance
-
ElementFieldList
- Implements
- Inherited Members
- Extension Methods
Remarks
Originally created by JJTeam on 2017-03-22.
Constructors
ElementFieldList()
public ElementFieldList()
ElementFieldList(List<ElementField>)
Initializes a new instance of the ElementFieldList class with an existing list of fields.
public ElementFieldList(List<ElementField> fields)
Parameters
fields
List<ElementField>A list of ElementField objects to initialize the collection.
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
this[int]
Gets or sets the element at the specified index.
public ElementField this[int index] { get; set; }
Parameters
index
intThe zero-based index of the element to get or set.
Property Value
- ElementField
The element at the specified index.
Exceptions
- ArgumentOutOfRangeException
index
is not a valid index in the IList<T>.- NotSupportedException
The property is set and the IList<T> is read-only.
this[string]
public ElementField this[string fieldName] { get; set; }
Parameters
fieldName
string
Property Value
Methods
Add(ElementField)
Adds a new field to the collection.
public void Add(ElementField item)
Parameters
item
ElementFieldThe ElementField object to add.
Exceptions
- ArgumentException
Thrown if the item is null or already exists in the collection.
Add(string, string, FieldType, int, bool, FilterMode)
Adds a new field with the specified properties.
public void Add(string name, string label, FieldType dataType, int size, bool required, FilterMode filterMode)
Parameters
name
stringThe field name.
label
stringThe label or description.
dataType
FieldTypeThe data type of the field.
size
intThe size of the field.
required
boolIndicates whether the field is required.
filterMode
FilterModeThe filter mode of the field.
Add(string, string, FieldType, int, bool, FilterMode, FieldBehavior)
Adds a new field with the specified properties.
public void Add(string name, string label, FieldType dataType, int size, bool required, FilterMode filterMode, FieldBehavior dataBehavior)
Parameters
name
stringThe field name.
label
stringThe label or description.
dataType
FieldTypeThe data type of the field.
size
intThe size of the field.
required
boolIndicates whether the field is required.
filterMode
FilterModeThe filter mode of the field.
dataBehavior
FieldBehaviorSpecifies the behavior of the field.
AddPk(string, string, FieldType, int, bool, FilterMode)
Adds a new primary key field.
public void AddPk(string name, string label, FieldType dataType, int size, bool autoNum, FilterMode filterMode)
Parameters
name
stringThe primary key field name.
label
stringThe label or description.
dataType
FieldTypeThe data type of the field.
size
intThe size of the field.
autoNum
boolIndicates whether the field is auto-incremented.
filterMode
FilterModeThe filter mode of the field.
AddRange(IEnumerable<ElementField>)
public void AddRange(IEnumerable<ElementField> fields)
Parameters
fields
IEnumerable<ElementField>
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(ElementField)
Determines whether the ICollection<T> contains a specific value.
public bool Contains(ElementField item)
Parameters
item
ElementFieldThe object to locate in the ICollection<T>.
Returns
- bool
true if
item
is found in the ICollection<T>; otherwise, false.
ContainsKey(string)
Determines whether a field with the specified name exists in the list.
public bool ContainsKey(string name)
Parameters
name
stringThe name of the field to locate.
Returns
- bool
true
if a field with the specified name exists; otherwise,false
.
CopyTo(ElementField[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(ElementField[] array, int arrayIndex)
Parameters
array
ElementField[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to the end of the destinationarray
.
DeepCopy()
public ElementFieldList DeepCopy()
Returns
FindAll(Predicate<ElementField>)
public List<ElementField> FindAll(Predicate<ElementField> predicate)
Parameters
predicate
Predicate<ElementField>
Returns
GetAsList()
public List<ElementField> GetAsList()
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<ElementField> GetEnumerator()
Returns
- IEnumerator<ElementField>
An enumerator that can be used to iterate through the collection.
IndexOf(ElementField)
Determines the index of a specific item in the IList<T>.
public int IndexOf(ElementField item)
Parameters
item
ElementFieldThe object to locate in the IList<T>.
Returns
- int
The index of
item
if found in the list; otherwise, -1.
Insert(int, ElementField)
Inserts an item to the IList<T> at the specified index.
public void Insert(int index, ElementField item)
Parameters
index
intThe zero-based index at which
item
should be inserted.item
ElementFieldThe object to insert into the IList<T>.
Exceptions
- ArgumentOutOfRangeException
index
is not a valid index in the IList<T>.- NotSupportedException
The IList<T> is read-only.
Remove(ElementField)
Removes the first occurrence of a specific object from the ICollection<T>.
public bool Remove(ElementField item)
Parameters
item
ElementFieldThe object to remove from the ICollection<T>.
Returns
- bool
true if
item
was successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitem
is not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
RemoveAt(int)
Removes the IList<T> item at the specified index.
public void RemoveAt(int index)
Parameters
index
intThe zero-based index of the item to remove.
Exceptions
- ArgumentOutOfRangeException
index
is not a valid index in the IList<T>.- NotSupportedException
The IList<T> is read-only.