Table of Contents

Class MethodDefinition

Namespace
RDCore.Forms.Model
Assembly
RDCore.Forms.dll

A method a component class has, or a property that a form's window answers for it: its name and its parameters, as a program's code calls it.

public sealed class MethodDefinition
Inheritance
MethodDefinition
Inherited Members

Remarks

The definition describes the call. What the method does is the form's: a shown form's window runs it (see RDFormsFormWindow.Invoke in RDCore.Forms.Avalonia).

A property here is one whose value the window's control holds, such as a ListBox's ListIndex, or one that takes arguments, such as its List(Index). Value gives its type. The window reads it with Invoke, and assigns it with Assign unless it IsReadOnly. Where the class has a model property of the same name, such as a ListBox's List, a running program reaches this one, and a designer the model's.

Constructors

MethodDefinition(string, params IReadOnlyList<MethodParameter>)

Creates a method definition.

public MethodDefinition(string name, params IReadOnlyList<MethodParameter> parameters)

Parameters

name string

The method's name.

parameters IReadOnlyList<MethodParameter>

The method's parameters, in order.

Exceptions

ArgumentException

name is empty or white space, or a required parameter follows an optional one.

Properties

IsProperty

Whether the definition is a property's: whether it has a Value.

public bool IsProperty { get; }

Property Value

bool

IsReadOnly

Whether a program can only read the property. An assignment is error 383, after its value is coerced to the property's type.

public bool IsReadOnly { get; init; }

Property Value

bool

Name

The method's name.

public string Name { get; }

Property Value

string

Parameters

The method's parameters, in the order a call gives them.

public IReadOnlyList<MethodParameter> Parameters { get; }

Property Value

IReadOnlyList<MethodParameter>

RequiredCount

The number of arguments a call must give: the parameters before the first optional one.

public int RequiredCount { get; }

Property Value

int

Value

For a property, its value: the type a read returns, and the type an assignment's value is coerced to. null for a method.

public MethodParameter? Value { get; init; }

Property Value

MethodParameter

Methods

ToString()

The method's name.

public override string ToString()

Returns

string

The method's name.