Class FieldValues
Encapsulates a collection of field values.
Inheritance
Inherited Members
Namespace: Sdl.LanguagePlatform.TranslationMemory
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
public class FieldValues : IEnumerable<FieldValue>, IEnumerable
Constructors
FieldValues()
Initializes a new instance with default values.
Declaration
public FieldValues()
FieldValues(FieldValues)
Initializes a new instance of the FieldValues class from another instance.
Declaration
public FieldValues(FieldValues other)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | other | The other instance. |
Properties
Count
Gets the number of field values contained in this instance.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Item[Int32]
Gets the field value at the specified index position.
Declaration
public FieldValue this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index position |
Property Value
Type | Description |
---|---|
FieldValue | The field value at the specified position. |
Item[String]
Gets the field value with the specified name.
Declaration
public FieldValue this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
Property Value
Type | Description |
---|---|
FieldValue | The field value with that name, and |
Values
Gets or sets the list of field values.
Declaration
public List<FieldValue> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<FieldValue> |
Methods
Add(FieldValue)
Adds a new field value to this instance.
Declaration
public void Add(FieldValue fv)
Parameters
Type | Name | Description |
---|---|---|
FieldValue | fv |
Assign(FieldValues)
Replaces the current field values with those of another instance.
Declaration
public bool Assign(FieldValues values)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The other instance. |
Returns
Type | Description |
---|---|
System.Boolean | true iff field values were changed by the assignment |
Clear()
Removes all the elements from this instance.
Declaration
public void Clear()
Exists(String)
Determines whether a field value with the specified name exists in the current instance.
Declaration
public bool Exists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
Returns
Type | Description |
---|---|
System.Boolean | true if it exists, otherwise false. |
GetEnumerator()
Returns an enumerator that iterates through the members of the underlying collection.
Declaration
public IEnumerator<FieldValue> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<FieldValue> |
Insert(Int32, FieldValue)
Inserts a new field value at the specified index
Declaration
public void Insert(int index, FieldValue fv)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
FieldValue | fv |
Lookup(String)
Returns a field value with the specified name.
Declaration
public FieldValue Lookup(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
Returns
Type | Description |
---|---|
FieldValue | The FieldValue object if exists, otherwise null. |
Lookup(String, FieldValueType)
Returns a field value with the specified name and performs a type check on the result.
Throws an error if the types do not match.
Declaration
public FieldValue Lookup(string name, FieldValueType expectedValueType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
FieldValueType | expectedValueType | The expected field type. |
Returns
Type | Description |
---|---|
FieldValue | The FieldValue object if exists, otherwise null. |
LookupOrCreate(String, FieldValueType)
Searches for a specified field in the current instance. If the field value exists, it will be returned, otherwise a new field value will be created, added to this instance and returned.
Declaration
public FieldValue LookupOrCreate(string name, FieldValueType valueType)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The field name. |
FieldValueType | valueType | The field type. |
Returns
Type | Description |
---|---|
FieldValue | A FieldValue object, never null. |
Merge(FieldValues)
Merge this instance's values with the one passed in the parameter. Single field values will be overwritten. Multiple field values will be merged.
Declaration
public bool Merge(FieldValues values)
Parameters
Type | Name | Description |
---|---|---|
FieldValues | values | The values to merge with this instance's values |
Returns
Type | Description |
---|---|
System.Boolean | true if this instance's values were changed, otherwise false. |
Remove(FieldValue)
Removes the specified field value from this instance.
Declaration
public bool Remove(FieldValue item)
Parameters
Type | Name | Description |
---|---|---|
FieldValue | item | The field value object. |
Returns
Type | Description |
---|---|
System.Boolean | true if it was removed, false if the item was not found. |
Remove(String)
Removes the field value with the specified name.
Declaration
public bool Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
System.Boolean | true iff the value was removed. |
RemoveAt(Int32)
Removes the field value at the specified position.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The position |
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through the members of the underlying collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |