Archived
This forum has been archived. Please start a new discussion on GitHub.
Using clr:property with cs:attribute
Hi,
I would like to be able to apply attributes to properties in my generated class.
// Foo.ice
["clr:property"]
class Foo
{
["cs:attribute:MyLibrary.MyOtherNameSpace.MyAttrib"]
int X;
}
This results in the following C# code:
//Foo.cs
class Foo
{
[MyLibrary.MyOtherNameSpace.MyAttrib]
private int X_prop;
public X
{
...getter + setter ...
}
}
The first problem is that the attribute is being applied on the private member instead of the property. Is there any way around this?
Is their any way to include the namespace so I do not have to fully qualify each attribute?
Thanks
Johan
I would like to be able to apply attributes to properties in my generated class.
// Foo.ice
["clr:property"]
class Foo
{
["cs:attribute:MyLibrary.MyOtherNameSpace.MyAttrib"]
int X;
}
This results in the following C# code:
//Foo.cs
class Foo
{
[MyLibrary.MyOtherNameSpace.MyAttrib]
private int X_prop;
public X
{
...getter + setter ...
}
}
The first problem is that the attribute is being applied on the private member instead of the property. Is there any way around this?
Is their any way to include the namespace so I do not have to fully qualify each attribute?
Thanks
Johan
0
Comments
-
Welcome to the forum!The first problem is that the attribute is being applied on the private member instead of the property.Is there any way around this?Is their any way to include the namespace so I do not have to fully qualify each attribute?
Regards,
Mark0 -
Thanks
Great, I made a local modification to the slice2cs generator for now.0