Skip to content

InterfaceDeclaration

CSharp interface declaration.

import { InterfaceDeclaration } from "@alloy-js/csharp";
<InterfaceDeclaration
attributes={AttributesProp}
doc={core.Children}
file
internal
name={string | core.Namekey}
partial
private
protected
public
refkey={core.Refkey}
typeParameters={(TypeParameterProps | string)[]}
/>
attributesoptional AttributesPropDefine attributes to attach
docoptional ChildrenDoc comment
fileoptional boolean
internaloptional boolean
namestring | Namekey
partialoptional boolean
privateoptional boolean
protectedoptional boolean
publicoptional boolean
refkeyoptional Refkey
typeParametersoptional (TypeParameterProps | string)[]Type parameters for the interface
<InterfaceDeclaration public name="IMyInterface">
  <InterfaceMember public name="MyProperty" type="int" />
  <InterfaceMethod public name="MyMethod" returnType="void">
    <Parameter name="value" type="int" />
  </InterfaceMethod>
</InterfaceDeclaration>

This will produce:

public interface MyIface
{
  public int MyProperty { get; set; }
  public void MyMethod(int value);
}