开发者

If I have an attribute declared over a method in an interface, do I need to put the attribute again in the method delcaration in the class?

开发者 https://www.devze.com 2022-12-14 04:20 出处:网络
Let\'s say I have a method such as [OperationContract(IsOneWay = true)] void UpdateIndex(IndexElement[] indexElements);

Let's say I have a method such as

    [OperationContract(IsOneWay = true)]
    void UpdateIndex(IndexElement[] indexElements);

in an interface.

When I implement

    void UpdateIndex(IndexElement[] indexEl开发者_StackOverflowements);

in a class file, do I have to repaste the method attribute or will the compiler know from the definition in the interface?


For WCF interface attributes, you only need to put them on the interface methods, not the implementation. There are actually some different attributes that you can put on the implementation, but the "Contract" attributes only go on the interface.

0

精彩评论

暂无评论...
验证码 换一张
取 消