views:

1052

answers:

2

In C# I can do this to expose a property via WCF

[ServiceContractAttribute()]
public interface IFoo
{
  int Length
  { 
    [OperationContract()] get;
    [OperationContract()] set;
  }
}

I have to do it that way since OperationContract decorates a method but not a property. I'm working with a legacy interface that I can't easily change to remove the use of properties.

How do I perform the same thing in vb.net, I can't figure out what property syntax I would use in the interface.

+2  A: 

Unfortunately (as far as I know) VB uses a very simple property syntax for interfaces that does not allow you to specify attributes on the get or set.

Andrew Hare
I have an existing interface I have to provide remote access to. In my C# example provided, I can define the operation contract on the property getter and setter. In a vb.net interface, it doesn't seem to allow me to put attributes on the getter and setter of a property defined in the interface.
James Thigpen
Ah, I see what you mean now. I will edit my answer.
Andrew Hare
That's what I was afraid of. Thanks!
James Thigpen
No problem - I wish it was better news!
Andrew Hare
A: 
  <OperationContract(AsyncPattern:=True)>
VAnzelone