Visual Basic allows you to apply the attribute to properties.
Public Property Foo() As <MarshalAs(UnmanagedType.Currency)> Decimal
Get
Return Me._foo
End Get
Set(<MarshalAs(UnmanagedType.Currency)> ByVal value As Decimal)
Me._foo = value
End Set
End Property
Private _foo As Decimal
It is possible to apply the attribute to properties in C# with the following syntax:
public decimal Foo {
[return: MarshalAs(UnmanagedType.Currency)]
get {
return this.foo;
}
[param: MarshalAs(UnmanagedType.Currency)]
set {
this.foo = value;
}
}