Search Results for

    Show / Hide Table of Contents

    Class Field

    Represents a field declaration.

    Inheritance
    object
    PersistentObject
    Field
    PicklistField
    Implements
    ICloneable
    IField
    Inherited Members
    PersistentObject.ResourceId
    object.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    object.MemberwiseClone()
    Namespace: Sdl.LanguagePlatform.TranslationMemory
    Assembly: Sdl.LanguagePlatform.TranslationMemory.dll
    Syntax
    [DataContract]
    [KnownType(typeof(PicklistField))]
    public class Field : PersistentObject, ICloneable, IField

    Constructors

    Field()

    Initializes a new instance with an empty resource token.

    Declaration
    public Field()

    Field(Field)

    Initializes a new instance with the values of another instance, creating a deep copy.

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

    The other instance

    Field(string, FieldValueType)

    Initializes a new instance, with the specified name and type.

    Declaration
    public Field(string name, FieldValueType valueType)
    Parameters
    Type Name Description
    string name

    The field name.

    FieldValueType valueType

    The field type.

    Fields

    StructureContextFieldName

    The name for the structure context field name.

    Declaration
    public static readonly string StructureContextFieldName
    Field Value
    Type Description
    string

    TextContextFieldName

    A pseudo-name for the text context field. Since text context values are directly stored at the TU, and not represented as field values, this pseudo field name is only relevant for edit scripts.

    Declaration
    public static readonly string TextContextFieldName
    Field Value
    Type Description
    string

    Properties

    FieldType

    Gets the type of the field, i.e. whether it is a system or user-defined field.

    Declaration
    [DataMember]
    public FieldType FieldType { get; set; }
    Property Value
    Type Description
    FieldType

    IsSystemField

    Gets a flag which indicates that this field is a system field. System fields cannot be changed or deleted by the user. Setting this flag from user-code has no effect.

    Declaration
    public bool IsSystemField { get; }
    Property Value
    Type Description
    bool

    Name

    Gets or sets the field name.

    Declaration
    [DataMember]
    public string Name { get; set; }
    Property Value
    Type Description
    string

    PicklistItemNames

    The names of all picklist items for this Field. This collection will be empty if this field is not a SinglePicklist or MultiplePicklist.

    Declaration
    public virtual IList<string> PicklistItemNames { get; }
    Property Value
    Type Description
    IList<string>

    ValueType

    Gets or sets the field value type.

    Declaration
    [DataMember]
    public FieldValueType ValueType { get; set; }
    Property Value
    Type Description
    FieldValueType

    Methods

    CheckName(string)

    Checks the given name and throws an exception if the name is not valid.

    Declaration
    protected virtual void CheckName(string name)
    Parameters
    Type Name Description
    string name

    name

    Clone()

    Clone()

    Declaration
    public virtual object Clone()
    Returns
    Type Description
    object

    A new object that is a deep copy of this instance.

    CreateValue()

    Creates a FieldValue instance, with the same name and type as this field declaration.

    Declaration
    public FieldValue CreateValue()
    Returns
    Type Description
    FieldValue

    A FieldValue instance which is compatible with this field declaration.

    Duplicate()

    Creates a new instance that is a deep copy of this instance.

    Declaration
    public virtual Field Duplicate()
    Returns
    Type Description
    Field

    A new instance that is a deep copy of this instance.

    Equals(object)

    Determines whether this instance of Field and a specified object, which must also be a Field object, represent the same field declaration including the picklist according to type.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The other object.

    Returns
    Type Description
    bool

    true if obj represents the same field declaration as this instance; false otherwise.

    Overrides
    object.Equals(object)

    EqualsDeclaration(Field)

    Determines whether this instance of Field and a specified object, which must also be a Field object, represent the same field declaration, not considering the picklist.

    Declaration
    public bool EqualsDeclaration(Field other)
    Parameters
    Type Name Description
    Field other

    The other object.

    Returns
    Type Description
    bool

    true if other represents the same declaration but might have a different picklist; false otherwise.

    GetFieldType(string)

    Determine the field type, given the field name.

    Declaration
    public static FieldType GetFieldType(string name)
    Parameters
    Type Name Description
    string name

    The field name to determine the field type for

    Returns
    Type Description
    FieldType

    The field type, if it can be determined, or FieldType.User if the field name is not reserved for system prposes.

    GetHashCode()

    System.Object.GetHashCode(object)

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()

    IsPseudoFieldName(string)

    Determines whether the name is reserved for a pseudo (non-physical) field.

    Declaration
    public static bool IsPseudoFieldName(string name)
    Parameters
    Type Name Description
    string name

    The field name to check

    Returns
    Type Description
    bool

    true if the name is reserved for a pseudo (non-physical) field, and false otherwise.

    IsReservedName(string)

    Determines whether the name is reserved for system purposes.

    Declaration
    public static bool IsReservedName(string name)
    Parameters
    Type Name Description
    string name

    The field name to check

    Returns
    Type Description
    bool

    true if the name is reserved (for a system field, pseudo field, or other field type), and false otherwise.

    IsSystemFieldName(string)

    Determines whether the specified name is reserved for a system (predefined) field.

    Declaration
    public static bool IsSystemFieldName(string name)
    Parameters
    Type Name Description
    string name

    The field name to check

    Returns
    Type Description
    bool

    true if the field name is a reserved system field name, and false otherwise

    IsValidName(string)

    Determines whether a specified string can be used as a field name.

    All field names are valid if they don't start or end with whitespace.

    Declaration
    public static bool IsValidName(string val)
    Parameters
    Type Name Description
    string val

    The string.

    Returns
    Type Description
    bool

    true if the string is a legal identifier, false otherwise.

    LookupSpecialField(string)

    Looks up a special field by its name. Special fields are fields with a predefined name, which may be "virtual" fields (those computed from data at runtime) or "physical" fields (which have an actual value in the data storage). Special field names should not be used for user-defined fields. Note that special fields are a superset of system fields (i.e. not all special fields are system fields).

    Declaration
    public static Field LookupSpecialField(string name)
    Parameters
    Type Name Description
    string name

    The field name

    Returns
    Type Description
    Field

    The special (predefined) field, or null if no such special field exists.

    RemoveIllegalChars(string)

    Removes those characters from an input string which are not allowed in field names, and returns the form that will be accepted as a field name identifier. This method should only be used when fields are automatically added by some process (e.g. by importing a TMX file) and that process should be robust and continue despite invalid field names.

    Declaration
    public static string RemoveIllegalChars(string val)
    Parameters
    Type Name Description
    string val

    The input string.

    Returns
    Type Description
    string

    The string after the illegal characters have been removed.

    Implements

    ICloneable
    IField
    In this article
    • Constructors
      • Field()
      • Field(Field)
      • Field(string, FieldValueType)
    • Fields
      • StructureContextFieldName
      • TextContextFieldName
    • Properties
      • FieldType
      • IsSystemField
      • Name
      • PicklistItemNames
      • ValueType
    • Methods
      • CheckName(string)
      • Clone()
      • CreateValue()
      • Duplicate()
      • Equals(object)
      • EqualsDeclaration(Field)
      • GetFieldType(string)
      • GetHashCode()
      • IsPseudoFieldName(string)
      • IsReservedName(string)
      • IsSystemFieldName(string)
      • IsValidName(string)
      • LookupSpecialField(string)
      • RemoveIllegalChars(string)
    • Implements
    Back to top Generated by DocFX