Table of Contents

Class PlainTextNodeBuilder

Namespace
HeyBox
Assembly
HeyBox.Net.Core.dll

用来构建 PlainTextNode 元素的构建器。

public class PlainTextNodeBuilder : ITextNodeBuilder, INodeBuilder, IEquatable<PlainTextNodeBuilder>, IEquatable<INodeBuilder>
Inheritance
PlainTextNodeBuilder
Implements
Inherited Members

Constructors

PlainTextNodeBuilder()

初始化一个 PlainTextNodeBuilder 类的新实例。

public PlainTextNodeBuilder()

PlainTextNodeBuilder(string?, NodeWidth?)

初始化一个 PlainTextNodeBuilder 类的新实例。

public PlainTextNodeBuilder(string? text, NodeWidth? width = null)

Parameters

text string

纯文本文本内容。

width NodeWidth?

节点的宽度。

Fields

MaxPlainTextLength

纯文本文本的最大长度。

public const int MaxPlainTextLength = 10000

Field Value

int

Properties

Text

获取或设置 Markdown 的文本内容。

public string? Text { get; set; }

Property Value

string

Type

获取此构建器构建的节点的类型。

public NodeType Type { get; }

Property Value

NodeType

Width

获取或设置此构建器构建的节点的大小。

public NodeWidth? Width { get; set; }

Property Value

NodeWidth?

Methods

Build()

构建当前构建器为一个 PlainTextNode

public PlainTextNode Build()

Returns

PlainTextNode

由当前构建器表示的属性构建的 PlainTextNode 对象。

Exceptions

ArgumentNullException

Textnull

ArgumentException

Text 的长度超过了 MaxPlainTextLength

Equals(PlainTextNodeBuilder?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(PlainTextNodeBuilder? plainTextNodeBuilder)

Parameters

plainTextNodeBuilder PlainTextNodeBuilder

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithText(string)

设置纯文本的文本内容,值将被设置到 Text 属性上。

public PlainTextNodeBuilder WithText(string text)

Parameters

text string

纯文本的文本内容。

Returns

PlainTextNodeBuilder

当前构建器。

WithWidth(NodeWidth)

设置节点的宽度,值将被设置到 Width 属性上。

public PlainTextNodeBuilder WithWidth(NodeWidth width)

Parameters

width NodeWidth

节点的宽度。

Returns

PlainTextNodeBuilder

当前构建器。

Operators

operator ==(PlainTextNodeBuilder?, PlainTextNodeBuilder?)

判定两个 PlainTextNodeBuilder 是否相等。

public static bool operator ==(PlainTextNodeBuilder? left, PlainTextNodeBuilder? right)

Parameters

left PlainTextNodeBuilder
right PlainTextNodeBuilder

Returns

bool

如果两个 PlainTextNodeBuilder 相等,则为 true;否则为 false

implicit operator PlainTextNodeBuilder(string)

使用指定的纯文本文本内容初始化一个新的 PlainTextNodeBuilder 类的实例。

public static implicit operator PlainTextNodeBuilder(string text)

Parameters

text string

纯文本文本内容。

Returns

PlainTextNodeBuilder

一个使用指定的纯文本文本内容初始化的 PlainTextNodeBuilder 类的实例。

operator !=(PlainTextNodeBuilder?, PlainTextNodeBuilder?)

判定两个 PlainTextNodeBuilder 是否不相等。

public static bool operator !=(PlainTextNodeBuilder? left, PlainTextNodeBuilder? right)

Parameters

left PlainTextNodeBuilder
right PlainTextNodeBuilder

Returns

bool

如果两个 PlainTextNodeBuilder 不相等,则为 true;否则为 false