Table of Contents

Class CardBuilder

Namespace
Kook
Assembly
Kook.Net.Core.dll

Represents a builder class for creating a Card.

public class CardBuilder : ICardBuilder, IEquatable<CardBuilder>, IEquatable<ICardBuilder>
Inheritance
CardBuilder
Implements
Inherited Members
Extension Methods

Constructors

CardBuilder(CardTheme, Color?, CardSize, IList<IModuleBuilder>?)

Initializes a new instance of the CardBuilder class with the specified parameters.

public CardBuilder(CardTheme theme = CardTheme.Primary, Color? color = null, CardSize size = CardSize.Large, IList<IModuleBuilder>? modules = null)

Parameters

theme CardTheme

The theme of the card.

color Color?

The color displayed along the left side of the card.

size CardSize

The size of the card.

modules IList<IModuleBuilder>

The modules in the card.

Properties

Color

Gets or sets the color displayed along the left side of the card.

public Color? Color { get; set; }

Property Value

Color?

A Color value that represents the color displayed along the left side of the card.

Modules

Gets or sets the modules in the card.

public IList<IModuleBuilder> Modules { get; set; }

Property Value

IList<IModuleBuilder>

An IList<T> containing the modules in the card.

Size

Gets or sets the size of the card.

public CardSize Size { get; set; }

Property Value

CardSize

A CardSize value that represents the size of the card.

Theme

Gets or sets the theme of the card.

public CardTheme Theme { get; set; }

Property Value

CardTheme

A CardTheme value that represents the theme of the card.

Type

Gets the type of the card.

public CardType Type { get; }

Property Value

CardType

A CardType value that represents the type of the card.

Methods

AddModule(IModuleBuilder)

Adds a module to the card.

public CardBuilder AddModule(IModuleBuilder module)

Parameters

module IModuleBuilder

An IModuleBuilder that represents the module to be added to the card.

Returns

CardBuilder

The current builder.

AddModule<T>(Action<T>?)

Adds a module to the card.

public CardBuilder AddModule<T>(Action<T>? action = null) where T : IModuleBuilder, new()

Parameters

action Action<T>

The action to adds a module to the card.

Returns

CardBuilder

The current builder.

Type Parameters

T

Build()

Builds the CardBuilder into a Card.

public Card Build()

Returns

Card

A KMarkdownElement represents the built element object.

Equals(CardBuilder?)

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

public bool Equals(CardBuilder? cardBuilder)

Parameters

cardBuilder CardBuilder

The CardBuilder to compare with the current CardBuilder.

Returns

bool

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

Equals(object?)

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

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current CardBuilder.

Returns

bool

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

WithColor(Color?)

Sets the color displayed along the left side of the card.

public CardBuilder WithColor(Color? color)

Parameters

color Color?

A Color value that represents the color displayed along the left side of the card to be set.

Returns

CardBuilder

The current builder.

WithSize(CardSize)

Sets the size of the card.

public CardBuilder WithSize(CardSize size)

Parameters

size CardSize

A CardSize value that represents the size of the card to be set.

Returns

CardBuilder

The current builder.

WithTheme(CardTheme)

Sets the theme of the card.

public CardBuilder WithTheme(CardTheme theme)

Parameters

theme CardTheme

A CardTheme value that represents the theme of the card to be set.

Returns

CardBuilder

The current builder.

Operators

operator ==(CardBuilder?, CardBuilder?)

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

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

Parameters

left CardBuilder
right CardBuilder

Returns

bool

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

operator !=(CardBuilder?, CardBuilder?)

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

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

Parameters

left CardBuilder
right CardBuilder

Returns

bool

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