When the directive ["clr: property"] is used with structs, incorrect code is generated. Given this Slice definition:
The code generated for the struct constructor does not compile, returning the error "'this' object cannot be used before all of its fields are assigned to":Code:["clr:property"] struct Date { byte Day; byte Month; short Year; };
The assigments should be made to the fields, not the properties.Code:public Date(byte Day, byte Month, short Year) { this.Day = Day; this.Month = Month; this.Year = Year; }
Btw, is there a reason why private fields and method parameters in the C# code are capitalized? This is a very uncommon code style for C#.
Karl

Reply With Quote
