RecordDeclaration
CSharp record declaration.
Props to use the RecordDeclaration component
import { RecordDeclaration } from "@alloy-js/csharp";
<RecordDeclaration doc={core.Children} file internal name={string | core.Namekey} partial primaryConstructor={ParameterProps[]} private protected public refkey={core.Refkey} typeParameters={Record<string, core.Refkey>} />import { RecordDeclaration } from "@alloy-js/csharp/stc";
RecordDeclaration({ doc: core.Children, file: boolean, internal: boolean, name: string | core.Namekey, partial: boolean, primaryConstructor: ParameterProps[], private: boolean, protected: boolean, public: boolean, refkey: core.Refkey, typeParameters: Record<string, core.Refkey>,}).children(children)| doc | optionalChildrenDoc comment |
| file | optionalboolean |
| internal | optionalboolean |
| name | string | Namekey |
| partial | optionalboolean |
| primaryConstructor | optionalParameterProps[]Set the primary constructor parameters |
| private | optionalboolean |
| protected | optionalboolean |
| public | optionalboolean |
| refkey | optionalRefkey |
| typeParameters | optionalRecord<string, Refkey> |
Example
Section titled “Example”<RecordDeclaration public name="IMyRecord"> <RecordMember public name="MyProperty" type="int" /> <RecordMethod public name="MyMethod" returnType="void"> <Parameter name="value" type="int" /> </RecordMethod></RecordDeclaration>This will produce:
public record MyIface{ public int MyProperty { get; set; } public void MyMethod(int value);}