Table of Contents

Class ContainerDescriptionExtensions

Namespace
NanoByte.StructureEditor
Assembly
NanoByte.StructureEditor.dll

Provides extensions methods for IContainerDescription<TContainer>.

public static class ContainerDescriptionExtensions
Inheritance
object
ContainerDescriptionExtensions

Methods

AddList<TContainer, TElement, TEditor>(IContainerDescription<TContainer>, string, Func<TContainer, IList<TElement>>, TEditor)

Adds a list to the description.

public static IContainerDescription<TContainer> AddList<TContainer, TElement, TEditor>(this IContainerDescription<TContainer> description, string name, Func<TContainer, IList<TElement>> getList, TEditor editor) where TContainer : class where TElement : class, new() where TEditor : notnull, INodeEditor<TElement>, new()

Parameters

description IContainerDescription<TContainer>
name string

The name of the element type.

getList Func<TContainer, IList<TElement>>

A function to retrieve the list from the container.

editor TEditor

Dummy element used for type inference of TEditor.

Returns

IContainerDescription<TContainer>

The "this" pointer for use in a "Fluent API" style.

Type Parameters

TContainer
TElement

The type of elements in the list.

TEditor

An editor for modifying the content of the element.

AddProperty<TContainer, TProperty, TEditor>(IContainerDescription<TContainer>, string, Func<TContainer, PropertyPointer<TProperty?>>, TEditor)

Adds a property to the description.

public static IContainerDescription<TContainer> AddProperty<TContainer, TProperty, TEditor>(this IContainerDescription<TContainer> description, string name, Func<TContainer, PropertyPointer<TProperty?>> getPointer, TEditor editor) where TContainer : class where TProperty : class, new() where TEditor : notnull, INodeEditor<TProperty>, new()

Parameters

description IContainerDescription<TContainer>
name string

The name of the property.

getPointer Func<TContainer, PropertyPointer<TProperty>>

A function to retrieve a pointer to the property in the container.

editor TEditor

Dummy element used for type inference of TEditor.

Returns

IContainerDescription<TContainer>

The "this" pointer for use in a "Fluent API" style.

Type Parameters

TContainer
TProperty

The type of the property.

TEditor

An editor for modifying the content of the property.

AddRequiredProperty<TContainer, TProperty, TEditor>(IContainerDescription<TContainer>, string, Func<TContainer, PropertyPointer<TProperty>>, TEditor)

Adds a required (non-nullable) property to the description.

public static IContainerDescription<TContainer> AddRequiredProperty<TContainer, TProperty, TEditor>(this IContainerDescription<TContainer> description, string name, Func<TContainer, PropertyPointer<TProperty>> getPointer, TEditor editor) where TContainer : class where TProperty : class, new() where TEditor : notnull, INodeEditor<TProperty>, new()

Parameters

description IContainerDescription<TContainer>
name string

The name of the property.

getPointer Func<TContainer, PropertyPointer<TProperty>>

A function to retrieve a pointer to the property in the container.

editor TEditor

Dummy element used for type inference of TEditor.

Returns

IContainerDescription<TContainer>

The "this" pointer for use in a "Fluent API" style.

Type Parameters

TContainer
TProperty

The type of the property.

TEditor

An editor for modifying the content of the property.