Class KMarkdownElementBuilder
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
An element builder to build a KMarkdownElement.
public class KMarkdownElementBuilder : IElementBuilder, IEquatable<KMarkdownElementBuilder>, IEquatable<IElementBuilder>
- Inheritance
-
KMarkdownElementBuilder
- Implements
- Inherited Members
Constructors
KMarkdownElementBuilder()
Initializes a new instance of the KMarkdownElementBuilder class.
public KMarkdownElementBuilder()
KMarkdownElementBuilder(string?)
Initializes a new instance of the KMarkdownElementBuilder class.
public KMarkdownElementBuilder(string? content)
Parameters
content
string
Fields
MaxKMarkdownLength
Gets the maximum KMarkdown length allowed by Kook.
public const int MaxKMarkdownLength = 5000
Field Value
Properties
Content
Gets or sets the content of a KMarkdownElementBuilder.
public string? Content { get; set; }
Property Value
- string
The content of the KMarkdownElementBuilder.
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
Build()
Builds the KMarkdownElementBuilder into a KMarkdownElement.
public KMarkdownElement Build()
Returns
- KMarkdownElement
A KMarkdownElement represents the built element object.
Exceptions
- ArgumentNullException
The Content is null.
- ArgumentException
The length of Content is greater than MaxKMarkdownLength.
Equals(KMarkdownElementBuilder?)
Determines whether the specified KMarkdownElementBuilder is equal to the current KMarkdownElementBuilder.
public bool Equals(KMarkdownElementBuilder? kMarkdownElementBuilder)
Parameters
kMarkdownElementBuilder
KMarkdownElementBuilderThe KMarkdownElementBuilder to compare with the current KMarkdownElementBuilder.
Returns
- bool
true
if the specified KMarkdownElementBuilder is equal to the current KMarkdownElementBuilder; otherwise,false
.
Equals(object?)
Determines whether the specified object is equal to the current KMarkdownElementBuilder.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current KMarkdownElementBuilder.
Returns
- bool
true
if the specified object is equal to the current KMarkdownElementBuilder; otherwise,false
.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
WithContent(string)
Sets the content of a KMarkdownElementBuilder.
public KMarkdownElementBuilder WithContent(string content)
Parameters
content
stringThe text to be set as the content.
Returns
- KMarkdownElementBuilder
The current builder.
Operators
operator ==(KMarkdownElementBuilder?, KMarkdownElementBuilder?)
Determines whether the specified KMarkdownElementBuilder is equal to the current KMarkdownElementBuilder.
public static bool operator ==(KMarkdownElementBuilder? left, KMarkdownElementBuilder? right)
Parameters
left
KMarkdownElementBuilderright
KMarkdownElementBuilder
Returns
- bool
true
if the specified KMarkdownElementBuilder is equal to the current KMarkdownElementBuilder; otherwise,false
.
implicit operator KMarkdownElementBuilder(string)
Initialized a new instance of the KMarkdownElementBuilder class with the specified content.
public static implicit operator KMarkdownElementBuilder(string content)
Parameters
content
stringThe content of the KMarkdownElement.
Returns
- KMarkdownElementBuilder
A KMarkdownElementBuilder object that is initialized with the specified content.
operator !=(KMarkdownElementBuilder?, KMarkdownElementBuilder?)
Determines whether the specified KMarkdownElementBuilder is not equal to the current KMarkdownElementBuilder.
public static bool operator !=(KMarkdownElementBuilder? left, KMarkdownElementBuilder? right)
Parameters
left
KMarkdownElementBuilderright
KMarkdownElementBuilder
Returns
- bool
true
if the specified KMarkdownElementBuilder is not equal to the current KMarkdownElementBuilder; otherwise,false
.