diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 8da934c8..e0334a1e 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -213,7 +213,9 @@ namespace CppSharp.Generators.CSharp PushBlock(BlockKind.Functions); var parentName = SafeIdentifier(context.TranslationUnit.FileNameWithoutExtension); - WriteLine("public unsafe partial class {0}", parentName); + var @class = context.Classes.Find(c => c.Name == parentName); + var keyword = @class != null && @class.IsValueType ? "struct" : "class"; + WriteLine($"public unsafe partial {keyword} {parentName}"); WriteStartBraceIndent(); PushBlock(BlockKind.InternalsClass); @@ -3233,4 +3235,4 @@ namespace CppSharp.Generators.CSharp public SymbolNotFoundException(string msg) : base(msg) {} } -} \ No newline at end of file +}