Archived
This forum has been archived. Please start a new discussion on GitHub.
strcuts and ["clr:property"]
kwaclaw
Oshawa, Canada
in Bug Reports
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":
The assigments should be made to the fields, not the properties.
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
["clr:property"]
struct Date {
byte Day;
byte Month;
short Year;
};
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":
public Date(byte Day, byte Month, short Year)
{
this.Day = Day;
this.Month = Month;
this.Year = Year;
}
The assigments should be made to the fields, not the properties.
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
0
Comments
-
When the directive ["clr: property"] is used with structs, incorrect code is generated.
Thanks for the bug report! I'll have a look at this.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#.
They use whatever capitalization you use for the corresponding Slice identifier.
Cheers,
Michi.0