Search Results for

    Show / Hide Table of Contents

    Class FieldDefinitions

    Encapsulates a set of field declarations. Fields are identified through their name or through their GUID. Note that field names are case-insensitive.

    Inheritance
    object
    FieldDefinitions
    Implements
    IEnumerable<Field>
    IEnumerable
    IFieldDefinitions
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.TranslationMemory
    Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
    Syntax
    [DataContract]
    public class FieldDefinitions : IEnumerable<Field>, IEnumerable, IFieldDefinitions

    Constructors

    FieldDefinitions()

    Initializes a new instance with an empty field declaration list.

    Declaration
    public FieldDefinitions()

    FieldDefinitions(FieldDefinitions)

    Initializes a new instance, copying the field declarations from the provided collection (deep copy).

    Declaration
    public FieldDefinitions(FieldDefinitions other)
    Parameters
    Type Name Description
    FieldDefinitions other

    FieldDefinitions(ICollection<Field>)

    Initializes a new instance, copying the field declarations from the provided collection (deep copy).

    Declaration
    public FieldDefinitions(ICollection<Field> fields)
    Parameters
    Type Name Description
    ICollection<Field> fields

    Properties

    Count

    Gets the number of fields in this collection.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    Fields

    Gets the underlying list of field declarations.

    Declaration
    [DataMember]
    public ICollection<Field> Fields { get; set; }
    Property Value
    Type Description
    ICollection<Field>

    this[Guid]

    Gets the field with the specified GUID, or null if there is no field with that GUID.

    Declaration
    public Field this[Guid guid] { get; }
    Parameters
    Type Name Description
    Guid guid
    Property Value
    Type Description
    Field

    this[string]

    Gets the field with the specified name, or null if there is no field with that name. Field names are case-insensitive.

    Declaration
    public Field this[string name] { get; }
    Parameters
    Type Name Description
    string name

    The field name to look up

    Property Value
    Type Description
    Field

    The field, or null if no field with the provided name exists.

    Methods

    Add(Field)

    Adds a new field to the list. Throws an error if the field already exists or if no additions are allowed.

    Declaration
    public void Add(Field f)
    Parameters
    Type Name Description
    Field f

    The field.

    Add(string, FieldValueType)

    Creates a new field declaration with the specified name and type and adds it to the list.

    Declaration
    public Field Add(string fieldName, FieldValueType fieldType)
    Parameters
    Type Name Description
    string fieldName

    The field name.

    FieldValueType fieldType

    The field type.

    Returns
    Type Description
    Field

    The newly created field declaration or an error if the field already exists.

    Clear()

    Remove all the fields currently associated with this definition.

    Declaration
    public void Clear()

    Contains(string)

    Determines whether a named field exists in the collection. Field names are case-insensitive.

    Declaration
    public bool Contains(string fieldName)
    Parameters
    Type Name Description
    string fieldName

    The name of the field to look up.

    Returns
    Type Description
    bool

    true if the specified field name exists; otherwise, false.

    Exists(Field)

    Retrieves a value indicating whether the specified field exists in the collection. Only the name, not the data type, is checked.

    Declaration
    public bool Exists(Field f)
    Parameters
    Type Name Description
    Field f

    The field.

    Returns
    Type Description
    bool

    true if a field with such a name exists, otherwise false.

    Exists(string)

    Retrieves a value indicating whether a field with the specified name exists.

    Declaration
    public bool Exists(string name)
    Parameters
    Type Name Description
    string name

    The field name.

    Returns
    Type Description
    bool

    true if the such a field exists, otherwise false.

    GetEnumerator()

    Returns an enumerator which can be used to iterate through the field list.

    Declaration
    public IEnumerator<Field> GetEnumerator()
    Returns
    Type Description
    IEnumerator<Field>

    An enumerator

    Lookup(Guid)

    Retrieves a field by its GUID.

    Declaration
    public Field Lookup(Guid guid)
    Parameters
    Type Name Description
    Guid guid

    The GUID to look up

    Returns
    Type Description
    Field

    The field with the specified GUID, or null if no such field exists.

    Lookup(string)

    Retrieves the field declaration with the specified name. Field names are case-insensitive.

    Declaration
    public Field Lookup(string name)
    Parameters
    Type Name Description
    string name

    The field name.

    Returns
    Type Description
    Field

    The field declaration or null if it does not exist.

    LookupIField(Guid)

    Returns the field with the specified GUID, or null if there is no field with that GUID.

    Declaration
    public IField LookupIField(Guid guid)
    Parameters
    Type Name Description
    Guid guid
    Returns
    Type Description
    IField

    LookupIField(string)

    Returns the field with the specified name, or null if there is no field with that name.

    Declaration
    public IField LookupIField(string name)
    Parameters
    Type Name Description
    string name
    Returns
    Type Description
    IField

    Remove(Field)

    Removes the field with the same name as the provided field, if one exists.

    Declaration
    public bool Remove(Field f)
    Parameters
    Type Name Description
    Field f

    The field to remove. Only the name is checked.

    Returns
    Type Description
    bool

    True if the field has been removed, false otherwise.

    Remove(string)

    Removes the field with the provided name, if one exists.

    Declaration
    public bool Remove(string fieldName)
    Parameters
    Type Name Description
    string fieldName

    The name of the field to remove.

    Returns
    Type Description
    bool

    True if the field has been removed, false otherwise.

    ToList()

    Generates and returns a deep copy of the field declarations.

    Declaration
    public List<Field> ToList()
    Returns
    Type Description
    List<Field>

    Implements

    IEnumerable<T>
    IEnumerable
    IFieldDefinitions
    In this article
    • Constructors
      • FieldDefinitions()
      • FieldDefinitions(FieldDefinitions)
      • FieldDefinitions(ICollection<Field>)
    • Properties
      • Count
      • Fields
      • this[Guid]
      • this[string]
    • Methods
      • Add(Field)
      • Add(string, FieldValueType)
      • Clear()
      • Contains(string)
      • Exists(Field)
      • Exists(string)
      • GetEnumerator()
      • Lookup(Guid)
      • Lookup(string)
      • LookupIField(Guid)
      • LookupIField(string)
      • Remove(Field)
      • Remove(string)
      • ToList()
    • Implements
    Back to top Generated by DocFX