Table of Contents

Class ParagraphStructBuilder

Namespace
Kook
Assembly
Kook.Net.Core.dll

An element builder to build a ParagraphStruct.

public class ParagraphStructBuilder : IElementBuilder, IEquatable<ParagraphStructBuilder>, IEquatable<IElementBuilder>
Inheritance
ParagraphStructBuilder
Implements
Inherited Members

Constructors

ParagraphStructBuilder()

Initializes a new ParagraphStructBuilder class.

public ParagraphStructBuilder()

ParagraphStructBuilder(int, IList<IElementBuilder>?)

Initializes a new ParagraphStructBuilder class.

public ParagraphStructBuilder(int columnCount, IList<IElementBuilder>? fields = null)

Parameters

columnCount int
fields IList<IElementBuilder>

Fields

MaxColumnCount

Returns the maximum number of columns allowed by Kook.

public const int MaxColumnCount = 3

Field Value

int

MaxFieldCount

Returns the maximum number of fields allowed by Kook.

public const int MaxFieldCount = 50

Field Value

int

MinColumnCount

Returns the minimum number of columns allowed by Kook.

public const int MinColumnCount = 1

Field Value

int

Properties

ColumnCount

Gets or sets the number of columns of the paragraph.

public int ColumnCount { get; set; }

Property Value

int

An int that represents the number of columns of the paragraph.

Fields

Gets or sets the fields of the paragraph.

public IList<IElementBuilder> Fields { get; set; }

Property Value

IList<IElementBuilder>

An IList<T> that represents the fields of the paragraph.

Type

Gets the type of the element that this builder builds.

public ElementType Type { get; }

Property Value

ElementType

An ElementType that represents the type of element that this builder builds.

Methods

AddField(KMarkdownElementBuilder)

Adds a field to the paragraph.

public ParagraphStructBuilder AddField(KMarkdownElementBuilder field)

Parameters

field KMarkdownElementBuilder

A KMarkdownElementBuilder that represents the field to add.

Returns

ParagraphStructBuilder

The current builder.

AddField(PlainTextElementBuilder)

Adds a field to the paragraph.

public ParagraphStructBuilder AddField(PlainTextElementBuilder field)

Parameters

field PlainTextElementBuilder

A PlainTextElementBuilder that represents the field to add.

Returns

ParagraphStructBuilder

The current builder.

AddField<T>(Action<T>?)

Adds a field to the paragraph.

public ParagraphStructBuilder AddField<T>(Action<T>? action = null) where T : IElementBuilder, new()

Parameters

action Action<T>

The action to create a builder of a KMarkdownElement, which will be added to the paragraph.

Returns

ParagraphStructBuilder

The current builder.

Type Parameters

T

Build()

public ParagraphStruct Build()

Returns

ParagraphStruct

A ParagraphStruct represents the built element object.

Exceptions

ArgumentOutOfRangeException

The ColumnCount is less than MinColumnCount.

ArgumentOutOfRangeException

The ColumnCount is greater than MaxColumnCount.

ArgumentNullException

The Fields is null.

ArgumentException

The number of Fields is greater than MaxFieldCount.

ArgumentException

The Fields contain an element that is not a PlainTextElementBuilder or KMarkdownElementBuilder.

Equals(ParagraphStructBuilder?)

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

public bool Equals(ParagraphStructBuilder? paragraphStructBuilder)

Parameters

paragraphStructBuilder ParagraphStructBuilder

The ParagraphStructBuilder to compare with the current ParagraphStructBuilder.

Returns

bool

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

Equals(object?)

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

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current ParagraphStructBuilder.

Returns

bool

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithColumnCount(int)

Sets the number of columns of the paragraph.

public ParagraphStructBuilder WithColumnCount(int count)

Parameters

count int

An int that represents the number of columns of the paragraph.

Returns

ParagraphStructBuilder

The current builder.

Operators

operator ==(ParagraphStructBuilder?, ParagraphStructBuilder?)

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

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

Parameters

left ParagraphStructBuilder
right ParagraphStructBuilder

Returns

bool

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

operator !=(ParagraphStructBuilder?, ParagraphStructBuilder?)

Determines whether the specified ParagraphStructBuilder is not equal to the current ParagraphStructBuilder.

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

Parameters

left ParagraphStructBuilder
right ParagraphStructBuilder

Returns

bool

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