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
namestringThe method's name.
parametersIReadOnlyList<MethodParameter>The method's parameters, in order.
Exceptions
- ArgumentException
nameis 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
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
Name
The method's name.
public string Name { get; }
Property Value
Parameters
The method's parameters, in the order a call gives them.
public IReadOnlyList<MethodParameter> Parameters { get; }
Property Value
RequiredCount
The number of arguments a call must give: the parameters before the first optional one.
public int RequiredCount { get; }
Property Value
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
Methods
ToString()
The method's name.
public override string ToString()
Returns
- string
The method's name.