Class FieldValues
Encapsulates a collection of field values.
Inherited Members
Namespace: SdlSdl.LanguagePlatformTranslationMemory
Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
Syntax
[DataContract]
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 |
---|---|
int |
this[int]
Gets the field value at the specified index position.
Declaration
public FieldValue this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index position |
Property Value
Type | Description |
---|---|
FieldValue | The field value at the specified position. |
this[string]
Gets the field value with the specified name.
Declaration
public FieldValue this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
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
[DataMember]
public List<FieldValue> Values { get; }
Property Value
Type | Description |
---|---|
ListFieldValue |
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 |
---|---|
bool | 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 |
---|---|---|
string | name | The field name. |
Returns
Type | Description |
---|---|
bool | 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 |
---|---|
IEnumeratorFieldValue |
Insert(int, FieldValue)
Inserts a new field value at the specified index
Declaration
public void Insert(int index, FieldValue fv)
Parameters
Type | Name | Description |
---|---|---|
int | index | |
FieldValue | fv |
Lookup(string)
Returns a field value with the specified name.
Declaration
public FieldValue Lookup(string name)
Parameters
Type | Name | Description |
---|---|---|
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 |
---|---|---|
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 |
---|---|---|
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 |
---|---|
bool | 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 |
---|---|
bool | 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 |
---|---|---|
string | name |
Returns
Type | Description |
---|---|
bool | true iff the value was removed. |
RemoveAt(int)
Removes the field value at the specified position.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The position |