Skip to main content

CSharp

Derive Macro CSharp 

Source
#[derive(CSharp)]
{
    // Attributes available to this derive:
    #[csharp]
    #[serde]
}
Expand description

Derives a C# type definition for the annotated Rust type.

Supports #[csharp(...)] attributes for customization and respects #[serde(...)] attributes for JSON serialization compatibility.

§Examples

use csharp_rs::CSharp;

#[derive(CSharp)]
#[csharp(export)]
struct Player {
    name: String,
    score: i32,
}