Skip to content

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>}
/>
docoptional ChildrenDoc comment
fileoptional boolean
internaloptional boolean
namestring | Namekey
partialoptional boolean
primaryConstructoroptional ParameterProps[]Set the primary constructor parameters
privateoptional boolean
protectedoptional boolean
publicoptional boolean
refkeyoptional Refkey
typeParametersoptional Record<string, Refkey>
<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);
}