PartBase<T> Class
Represents a part within a part-based edit box.
public abstract class PartBase<T> : IPart
- Type Parameters:
-
T
-The part value type.
- Inheritance:
- object object
- Derived:
- FormattedPartBase<T> LiteralPart
- Implements:
- IPart
Constructors
PartBase()
Initializes an instance of the class.
protected PartBase()
Properties
IsEditable
Gets whether the part is editable.
public virtual bool IsEditable { get; }
Property Value
- bool:
true
if the part is editable; otherwise,false
.
IsLiteral
Gets whether the part is a literal.
public virtual bool IsLiteral { get; }
Property Value
- bool:
true
if the part is a literal; otherwise,false
.
IsOptional
Gets whether this part is optional.
public virtual bool IsOptional { get; }
Property Value
- bool:
true
if this part is optional; otherwise,false
.
Length
Gets the character length of the part within the text.
public int Length { get; set; }
Property Value
- int:
The character length of the part within the text.
StartOffset
Gets the start offset of the part within the text.
public int StartOffset { get; set; }
Property Value
- int:
The start offset of the part within the text.
StringValue
Gets or sets the current string value of the part, if known.
public string StringValue { get; set; }
Property Value
- string:
The current string value of the part, if known.
Methods
TryParseText(IList<IPart>, string, int, CultureInfo, out int)
Tries to parse the text starting offset and returns the offset through which parsing was completed.
public abstract bool TryParseText(IList<IPart> parts, string text, int startOffset, CultureInfo culture, out int offset)
Parameter | Type | Description |
---|---|---|
parts | IList<IPart> | The part collection in which this part is a member. |
text | string | The text to examine. |
startOffset | int | The start offset. |
culture | CultureInfo | The CultureInfo to use. |
offset | int | Returns the offset through which parsing was completed. |
Returns
- bool:
true
if parsing was successful; otherwise,false
.