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 | optional Children | Doc comment |
| file | optional boolean | |
| internal | optional boolean | |
| name | string | Namekey | |
| partial | optional boolean | |
| primaryConstructor | optional ParameterProps[] | Set the primary constructor parameters |
| private | optional boolean | |
| protected | optional boolean | |
| public | optional boolean | |
| refkey | optional Refkey | |
| typeParameters | optional Record<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);
}